You can easily add syntax for another development tool such as C# to the SQL statement in the Editor to paste it into the development tool's code. You can also remove any syntax specific to the code development tool from the SQL statement so you can execute it in Toad. The modified syntax is saved to the clipboard, leaving the original statement unchanged.
The following pre-defined syntax templates are included with Toad:
C#
C++
Delphi
Java
Perl
Visual Basic
Scenario You have a query in Visual Basic to find all movies produced between 1990 and 2000. You need to remove all Visual Basic syntax so that you can run the query in your database. Original Visual Basic Statement:
Converted SQL Statement:
|
To remove the Visual Basic code from your query
Copy and paste the following code into Toad's Editor.
Dim SQL As String = _
"SELECT ""MOVIETITLE"".MOVIEID"
" , ""MOVIETITLE"".TITLE"
" , ""MOVIECATEGORY"".CATEGORYNAME"
" , ""MOVIECATEGORY"".RENTALPRICE"
" , ""MOVIETITLE"".YEAR"
"FROM "
" DB2ADMIN.MOVIETITLE ""MOVIETITLE"" INNER JOIN"
" DB2ADMIN.MOVIECATEGORY ""MOVIECATEGORY"" ON (""MOVIETITLE"".CATEGORYID = ""MOVIECATEGORY"".CATEGORYID) INNER JOIN"
" DB2ADMIN.MOVIECOPY ""MOVIECOPY"" ON (""MOVIECOPY"".MOVIEID = ""MOVIETITLE"".MOVIEID) "
"WHERE (""MOVIETITLE"".YEAR BETWEEN '2000' AND '2007')";
Click on the Editor toolbar (ALT+D+R) to remove the Visual Basic code and copy the statement to the clipboard.
Paste the statement into a new Editor in Toad:
SELECT "MOVIETITLE".movieid, "MOVIETITLE".title, "MOVIECATEGORY".categoryname,
"MOVIECATEGORY".rentalprice, "MOVIETITLE".year
FROM db2admin.movietitle "MOVIETITLE"
INNER JOIN
db2admin.moviecategory "MOVIECATEGORY"
ON ("MOVIETITLE".categoryid = "MOVIECATEGORY".categoryid)
INNER JOIN
db2admin.moviecopy "MOVIECOPY"
ON ("MOVIECOPY".movieid = "MOVIETITLE".movieid)
WHERE ("MOVIETITLE".year BETWEEN '2000' AND '2007')
Note: Your original SQL statement is not modified when removing application code.
To add application code
Select the SQL statement you want to add application code to in the Editor.
Click on the Editor toolbar (ALT+D+P) to copy the statement with the application code to the clipboard.
Tip: You can select a different template or create a new template from the drop-down list beside the icon.
Paste the statement into the other development tool.
Note: Your original SQL statement is not modified when adding the application code.
© ALL RIGHTS RESERVED. 이용 약관 개인정보 보호정책 Cookie Preference Center