Modifying SQL
Documents
You can modify SQL documents, including finding and replacing text.
To modify an SQL document
- Right click on the routine,
view, trigger, or synonym in the Object Explorer and select Edit
from the popup menu.
The SQL Editor document appears in the Document pane.
- Choose File->Open.
The Open dialog box appears.
- Go to the SQL document file
and open the file.
The SQL Editor document appears in the Document pane.
- Right-click in the editor
text box and select the appropriate editing commands from the popup menu.
- 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 document.
To find in an SQL document
- Choose Edit->Search.,
the Search toolbar button or the CTRL+F hotkey.
- In the Find what
text box, type the text that you want to locate.
- Check the Match whole word
only or the Match case check box to narrow your search.
- Click Find Next button
(or press the F3 hotkey) to locate subsequent occurrences of the
text.
- Click Cancel to close
the dialog box.
To replace in an SQL document
- Choose Edit->Replace,
the Replace toolbar button or the CTRL+R hotkey.
- In the Find what text box, type the text that you want
to locate.
- Check the Match whole word
only or the Match case check box to narrow your search.
- Type the new text in the Replace
with text box.
- Click Find Next
to locate subsequent occurrences of the text.
- Click Replace to replace the
found text with the new text, or click Replace All to replace all occurrences of the text.
- Click Cancel to close the dialog box.
Tips
- 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 will occur
when you execute the contents of the SQL Statements text box.
- 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 ( --
).