Toad World® Forums

How can I generate DDL script per table

Currently, I can generate a big sql script file for all entities:

Model -> Generate DDL Script…

However, I would like to generate sql script for each entity. This will fit our code review process.

Please advise!

Thanks!

I can think of a couple of ways to do this. First, just generate the sql script for everything in the model. Click on the ‘show code’ button and TDM should launch Toad for Oracle (in my case) and want to open this file in the editor. When it does that it will give you the option to ‘split the file’ into individual files.

Choose YES. The caveat here is that depending upon how many objects you have it may want to open a large amount of editor tabs (90 in my case) and Toad may hang with that many windows open.

Another way to do this would be to break your model down into ‘workspaces’ in Data Modeler. This allows you to create logical groupings of objects in your database and then you can generate the ddl script for an individual workspace. Breaking it up this way will allow you to create smaller sets of ddl scripts that are now manageable.

Thanks for your response.

The first solution seems amazing. However, I did not get an option like “Split Code”. I am using the SQL server 2014.

When I click the “Show Code”, I just get an pop up window without any toolbar or menu.

I may miss some configurations. Please advise! Thanks!

Toad Data Modeler assumes the output will be for Oracle and it automatically wants to launch Toad for Oracle.

To associate this with Toad for SQLServer, or some other editor, you can go into Options and define that relationship by searching for an editor to add in the "External Editor for Generated Code" dropdown on the right-side after choosing SS2014 on the left-side.

I still have not gotten this work. But I believe you point me to the right direction. Now, the SSMS will be the editor of the sql script when I click the “Show Code” button. But there still no an option for “split file.” Thanks!

then my guess would be that the ‘split file option’ is a feature of Toad for (database of choice) itself. Have you tried to use Toad for SQLServer as the editor?

If SSMS does not offer this feature, and maybe it does but it needs to be configured, then that definitely leads me towards it being a feature of Toad itself.

SQL Server runs as a service. I am not sure how to use this service as an external editor. I think there must be a checkbox somewhere in TOAD for SQL Sever to split the file. Thank you again!

Hi,

in the current beta version 6.2.2. is available a new option "Split output file" which allows you to split generated file per objects. You can find it on the tab "What to generate" of the DDL script generator..

It will be also available in the next commercial version.

Regards

David

that is awesome. Thanks!