In this lesson, you will generate a SQL script from a database model.
If the tutorial database is already running, go to step 2.
If the tutorial database is not running, in the WorkSpace Navigator, expand the folder MySybStore_Tutorials/Setup/Database. Right-click startMySybStore.bat and select Open With|System Editor to start the tutorial database.
You should see the Adaptive Server Anywhere icon in your Windows system tray.
If a connection to the SybStore tutorial database is already established, skip to step 3. When there is a successful connection, you see a database icon below the SybStore connection profile in the Enterprise Explorer.
If you are not connected, in the Enterprise Explorer, right-click the MySybStore connection profile, which you created in the tutorial setup, and select Connect to connect WorkSpace to the tutorial database.
Select Window|Open Perspective|Enterprise Modeling from the main menu bar to open the Enterprise Modeling perspective.
In the WorkSpace Navigator, expand the Models folder and double-click MySybStoreDBModel to open the database model file.
When the database model opens in the editor, double-click the arrow between the two table diagrams to open the Reference Properties window.
No action is required; after reviewing the properties, click OK to close the dialog box.
Select Database|Generate Database from the main menu bar.
When the Database Generation dialog box opens, complete these options:
Directory – verify that the path is:
%WS_INSTALL_DIR%\<user name>\MySybStore_Tutorials\Models
where <user name> is your personal WorkSpace directory.
File Name – enter SybStoreDB.sql
Select the Script Generation option.
Select the One File Only and Check Model options.
Choose the Selection tab.
The Tables page lists all of the tables available for selection in the model. By default, all tables are selected.
Click OK. Progress of the script-generation process is shown in the Modeling Output view, below the modeling editor.
When the script-generation process finishes, a Generated Files result box appears, showing the path of the generated script file. Click Close to remove the result box.
To view the generated script, in the WorkSpace Navigator, expand the folder MySybStore_Tutorials/Models. Double-click the SybStoreDB.sql script file. The SQL Editor displays the generated script.
Review the script. No action is required. Once you have reviewed the script, select File|Close on the WorkSpace main menu to close the SQL editor.
To close the perspective, select Window|Close Perspective from the WorkSpace main menu bar. You have generated the SQL script to create the database and the database objects you defined in the database model.