Because of the variety of ODBC drivers for both Oracle and SQL Server, you may not always get the same conversion string for the extended SQL functions. To assist with application debugging issues, you might want to consider using the SQLNativeSql function. This function returns the SQL string as translated by the driver.
The following are possible results for the following input SQL string that contains the scalar function CONVERT. The column SSN is defined as the type CHAR(9), and is converted to a numeric value.
Original statement |
Converted Oracle statement | Converted SQL Server statement |
---|---|---|
SELECT (fn CONVERT (SSN, SQL_INTEGER)} FROM STUDENT |
SELECT TO_NUMBER(SSN) FROM STUDENT |
SELECT CONVERT(INT, SSN) FROM STUDENT |