문제

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?

도움이 되었습니까?

해결책 2

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.

다른 팁

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)

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

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'

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

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.

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top