Export (0) Print
Expand All

Processing Embedded SQL Statements

SQL Server 2000

Embedded SQL for C (ESQL/C) fully supports all Transact-SQL extensions, including stored procedures, local variables, and control-of-flow language. Due to syntax conflicts with Embedded SQL reserved keywords, and because static SQL statements are compiled into stored procedures by the precompiler, minor restrictions apply to how Transact-SQL extensions are implemented. The restrictions are as follows:

  • The Transact-SQL EXECUTE statement should be abbreviated to EXEC to avoid conflict with the Embedded SQL EXECUTE statement.

  • Transact-SQL statement labels should not be used in static SQL statements because they conflict with the syntax for host variables. However, you can use Transact-SQL labels in dynamic SQL statements.

    If Microsoft® SQL Server™ 2000 returns an error during compilation, the SQL Server error code appears in the precompiler error message as a negative number, for example:

    SQL Syntax Error -SQLCODE = -207

    For more information about a list of messages returned by ESQL, see Embedded SQL for C Messages.

  • Because nsqlprep converts all static SQL statements into stored procedures, all limitations for Transact-SQL stored procedures apply to static SQL statements. A static SQL statement that contains a single transaction-management statement (such as COMMIT TRANSACTION or SAVEPOINT) is not compiled into a stored procedure. Instead, the statement is issued dynamically at run time.

For more information about restrictions that relate to other Embedded SQL statements, see Embedded SQL Statements.

© 2015 Microsoft