Creating SQL
Documents
To create a new SQL document
- Right-click the database in
the Object Explorer and select New SQL Editor from
the popup menu. The new SQL Editor page appears in the Document pane
of the Server Studio window. You can also choose File->New
SQL Editor. If there is no current database connection, Connect
dialog will popup; otherwise the current connection of the Object Explorer
is used.
- In the editor area, enter the
SQL statements.
- Choose SQL->Check
All Syntax to check the SQL statements before you submit
them to the database server.
- Choose SQL->Execute
All SQL to execute the SQL statements in the selected database.
The statements are submitted to the database selected in the Database list
box of the SQL Editor window.
Tips
- Use a semicolon to separate
SQL statements. For nonexecutable text, such as comment lines, enclose the
entire text in braces ( {} ) or precede each comment with two hyphens (
-- ).
- You can open any text file in
the SQL Editor. However, if the file contains nonexecutable text that is
not enclosed in braces or preceded by two hyphens, syntax errors occur when
you execute the contents of the SQL Statements text box.
- The Messages dockable page
displays summary information about the SQL statements that you execute.
- To execute the same SQL statements
in more than one database after you executed your SQL statements, select
another database from the Database list box of the SQL Editor page.
To execute the same SQL statements on a different server or using a
different user login, choose SQL->Connect or
press the toolbar Reconnect button.