How do I generate a script of all database objects in Toad for MySQL
Asked Answered
S

7

16

In the freeware version of Toad for MySQL (latest version), I can generate a script of all tables in my database in one file. However, for stored procedures and functions, Toad generates a separate script/file for each one.

Ideally, I'd like a simple step to generate a script for all objects in my database (tables, views, procedures, functions, triggers) to a single file.

Is that possible in Toad for MySQL?

Schaub answered 21/11, 2010 at 20:27 Comment(0)
S
4

I think I have found a definitive answer. This operation cannot be done in Toad for MySQL. What do all of you do?!

We have been asking for this feature for many years and it has been never implemented. We hope to have that this year. We'll see.

-Ernest

I don't know why so few people are asking for those "Scripts" enhancement features. I comes from the Microsoft SQL sides, with Toad, I can't select any objects(views, procedures ) then generate DDL and rerun it in Production system. The stored procedures script generated from Toad can't even run in Production unless "Delimiter" is added.

-Lawrence

Note: I have found a suitable option for now using HeidiSQL (see other answer), but HeidiSQL is not as robust as Toad for MySQL, and I would prefer not to mix IDEs.

Schaub answered 10/12, 2010 at 0:56 Comment(0)
S
12

I am happy to report that HeidiSQL does exactly what I need it to do. This feature alone is worth having the 3 MB .exe on your system:

alt text

As a bonus, it's lightweight and fast. It can't do everything Toad for MySQL does, but for most tasks, I will default to Heidi instead of SUPER SLOW Toad!

If someone can still answer my question about how to do this operation in Toad for MySQL, I will change my accepted answer.

(and another option I have is using mysqldump)

Schaub answered 22/11, 2010 at 18:29 Comment(0)
S
4

I think I have found a definitive answer. This operation cannot be done in Toad for MySQL. What do all of you do?!

We have been asking for this feature for many years and it has been never implemented. We hope to have that this year. We'll see.

-Ernest

I don't know why so few people are asking for those "Scripts" enhancement features. I comes from the Microsoft SQL sides, with Toad, I can't select any objects(views, procedures ) then generate DDL and rerun it in Production system. The stored procedures script generated from Toad can't even run in Production unless "Delimiter" is added.

-Lawrence

Note: I have found a suitable option for now using HeidiSQL (see other answer), but HeidiSQL is not as robust as Toad for MySQL, and I would prefer not to mix IDEs.

Schaub answered 10/12, 2010 at 0:56 Comment(0)
N
3

For anyone still needing an answer for Toad... Go to the Object Explorer -> select all the tables -> Right click and select 'Send To -> Editor As Script'

Norven answered 15/4, 2016 at 12:28 Comment(1)
This solution also works for Procedures. Object Explorer -> select all the procedures -> Right click and select 'Send To -> Editor As Script'.Androclinium
S
2

What about Database -> Export -> Generate schema script. After that - spefify DDL file name and on Object types tab select needed types.

PS: oops, I've given a recipe for Toad for Oracle, but may be for mysql it is similar

Scurrilous answered 21/11, 2010 at 23:42 Comment(2)
Thanks zerkms, unfortunately it's not similar at all :(Schaub
thanks, I'm searching for Oracle exactly. May it will help othersBulbous
J
1

Go to tools -> Export --> Export wizard Click Next

Click Next -> Add -> Databases

Select the databases you want to export

Click Next

Select the output format as SQL script

Select other options as below

Click Next -> Next -> Next -> export data

Your .sql scripts will exported to the file location

Janicejanicki answered 13/1, 2015 at 5:38 Comment(2)
If you want to export the complete DB in a single file heidi is better.Lorusso
Just does the data, not structure. Cannot do as one file.Chingchinghai
M
0

Found a workaround how to do it. In Object Explorer select all tables then Generate SQL > Creation Script. You have to run it few times on fresh database if you have relations. Unfortunately this can not be done for procedures.

Marlanamarlane answered 29/7, 2015 at 8:36 Comment(0)
M
0

It can be achieved using Tools > Compare function. You compare database with empty one, than after Toad compared databases Press Synchronize, then you will see option to open script in an editor.

Marlanamarlane answered 29/7, 2015 at 9:11 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.