How to generate a DDL SQL script from the diagram?

One of the SqlDBM features is that you can generate the SQL Script that creates your database along with its objects since the diagram you created. Click on the Forward Engineer - Generate SQL Script icon (Figure 1) that is on the left bottom, and ensure to have your changes already saved (press the combination "CTRL" + "S" in case isn't saved yet, or click on Save button on the right top).

Image 29

Figure 1. Forward Engineer - Generate SQL Script icon.

Select the tables to be created on the database as shown on the figure below.

Image 30

Figure 2. Tables selection.

Then, go to the right side panel where you'll see the Generation Options panel (Figure 3). This panel allows you to select the database objects to be scripted. Notice that for each object, you could generate either his drop or create statement. Select the generate options desired, and save it. 

Image 31

Figure 3. Script generation options.

Once you saved your work, then click on the Generate SQL blue button that is on the middle of the grid. This will start the SQL process generation, and you'll have a script structure like the following:

Image 32Figure 4. Script generated by SqlDBM Forward Engineer feature.

Notice there's three buttons on the top of this grid. These buttons are:


Image 35

Generate SQLGenerate SQL script.

Image 36

Clear SQLClear SQL statements generated.

Image 37

Copy ScriptCopy the SQL script into your clipboard.

Table 1. Buttons description.

The following animation show the process above. 

Image 38Animation 1. Generating a SQL script from the model created.

This article was helpful for 13 people. Is this article helpful for you?