Chatta subito con l'assistenza
Chat con il supporto

Toad Data Point 6.0.5 - User Guide

Add or Remove Application Code

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:

Dim SQL As String = _

"SELECT movietitle.MovieId,"+ vbCrLf + _

" movietitle.Title,"+ vbCrLf + _

" moviecategory.CategoryId,"+ vbCrLf + _

" movietitle.Year"+ vbCrLf + _

" FROM movies.movierental movierental"+ vbCrLf + _

" CROSS JOIN ( movies.movietitle movietitle"+ vbCrLf + _

" INNER JOIN"+ vbCrLf + _

" movies.moviecategory moviecategory"+ vbCrLf + _

" ON (movietitle.CategoryId = moviecategory.CategoryId))"+ vbCrLf + _

" INNER JOIN movies.moviecopy moviecopy"+ vbCrLf + _

" ON (moviecopy.MovieId = movietitle.MovieId)"+ vbCrLf + _

" WHERE (movietitle.Year BETWEEN '1990' AND '2000')"

 

Converted SQL Statement:

SELECT movietitle.MovieId,

movietitle.Title,

moviecategory.CategoryId,

movietitle.Year

FROM movies.movierental movierental

CROSS JOIN ( movies.movietitle movietitle

INNER JOIN

movies.moviecategory moviecategory

ON (movietitle.CategoryId = moviecategory.CategoryId))

INNER JOIN movies.moviecopy moviecopy

ON (moviecopy.MovieId = movietitle.MovieId)

WHERE (movietitle.Year BETWEEN '1990' AND '2000')

To remove the Visual Basic code from your query

  1. Copy and paste the following code into Toad's Editor.

    Dim SQL As String = _

    "SELECT movietitle.MovieId,"+ vbCrLf + _

    " movietitle.Title,"+ vbCrLf + _

    " moviecategory.CategoryId,"+ vbCrLf + _

    " movietitle.Year"+ vbCrLf + _

    " FROM movies.movierental movierental"+ vbCrLf + _

    " CROSS JOIN ( movies.movietitle movietitle"+ vbCrLf + _

    " INNER JOIN"+ vbCrLf + _

    " movies.moviecategory moviecategory"+ vbCrLf + _

    " ON (movietitle.CategoryId = moviecategory.CategoryId))"+ vbCrLf + _

    " INNER JOIN movies.moviecopy moviecopy"+ vbCrLf + _

    " ON (moviecopy.MovieId = movietitle.MovieId)"+ vbCrLf + _

    " WHERE (movietitle.Year BETWEEN '1990' AND '2000')"

  2. Click on the Editor toolbar (ALT+D+R) to remove the Visual Basic code and copy the statement to the clipboard.  

  3. Paste the statement into a new Editor in Toad:

    SELECT movietitle.MovieId,

    movietitle.Title,

    moviecategory.CategoryId,

    movietitle.Year

    FROM movies.movierental movierental

    CROSS JOIN ( movies.movietitle movietitle

    INNER JOIN

    movies.moviecategory moviecategory

    ON (movietitle.CategoryId = moviecategory.CategoryId))

    INNER JOIN movies.moviecopy moviecopy

    ON (moviecopy.MovieId = movietitle.MovieId)

    WHERE (movietitle.Year BETWEEN '1990' AND '2000')

    Note: Your original SQL statement is not modified when removing application code.  

To add application code

  1. Select the SQL statement you want to add application code to in the Editor.

  2. 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.

  3. Paste the statement into the other development tool.

    Note: Your original SQL statement is not modified when adding the application code.

 

Related Topics

Related Documents

The document was helpful.

Seleziona valutazione

I easily found the information I needed.

Seleziona valutazione