Contents IndexTransact-SQL procedure language overview Transact-SQL stored procedure overview

User's Guide
   Part IV. Transact-SQL Compatibility
     Chapter 31. Transact-SQL Procedure Language
      Automatic translation of SQL statements

In addition to supporting Transact-SQL alternative syntax, SQL Anywhere provides aids for translating statements between the Watcom-SQL and Transact-SQL dialects. The following functions return information about SQL statements and enable automatic translation of SQL statements:

These are functions, and so can be accessed, for example, using a select statement from ISQL. For example, the following statement:

     select SqlDialect('select * from employee')

returns the value WatcomSQL.

Top of page


Using Sybase Central to translate stored procedures

The Sybase Central database management tool has facilities for creating, viewing, and altering procedures and triggers.

  For information on connecting to a database using Sybase Central, and displaying database objects, see the chapter "Managing Databases with Sybase Central" or the Sybase Central online help.

To translate a stored procedure using Sybase Central:

  1. Connect to a database using Sybase Central, either as owner of the procedure you wish to change, or as a DBA user.
  2. Double-click the Procedures folder for the database to list the stored procedures in the database.
  3. Using the right mouse button, click the procedure you wish to translate, and choose the dialect you wish to translate it to from the popup menu: either Watcom-SQL or Transact-SQL.

    The procedure is displayed in the selected dialect. If the selected dialect is not the one in which the procedure is stored, it is translated to that dialect by the database engine. Any untranslated lines are displayed as comments.

  4. Rewrite any untranslated lines as needed, and click the Execute Script button to save the translated version to the database. You can also export the text to a file for editing outside Sybase Central.

Top of page


Contents IndexTransact-SQL procedure language overview Transact-SQL stored procedure overview