Export (0) Print
Expand All

Command Syntax

SQL Server 2000

SQLOLEDB recognizes command syntax specified by the DBGUID_SQL macro. For SQLOLEDB, the specifier indicates that an amalgam of ODBC SQL, SQL-92, and Transact-SQL is valid syntax. For example, the following SQL statement uses an ODBC SQL escape sequence to specify the LCASE string function:

SELECT customerid={fn LCASE(CustomerID)} FROM Customers

LCASE returns a character string, converting all uppercase characters to their lowercase equivalents. The SQL-92 string function LOWER performs the same operation, so the following SQL statement is a SQL-92 equivalent to the ODBC statement presented above:

SELECT customerid=LOWER(CustomerID) FROM Customers

SQLOLEDB processes either form of the statement successfully when specified as text for a command.

Stored Procedures

When executing a Microsoft® SQL Server™ 2000 stored procedure using a SQLOLEDB command, use the ODBC CALL escape sequence in the command text. SQLOLEDB then uses the remote procedure call mechanism of SQL Server 2000 to optimize command processing. For example, the following ODBC SQL statement is preferred command text over the Transact-SQL form:

  • ODBC SQL
    {call SalesByCategory('Produce', '1995')}
    
  • Transact-SQL
    EXECUTE SalesByCategory 'Produce', '1995'
    
Show:
© 2014 Microsoft