ODBC Scalar Functions


There are many functions defined in the ANSI standard for ODBC. Unfortunately different ODBC providers support them to different degrees. Many times function names are different than what the standard specifies. Many times the argument order is different.

Normally an SQL query sent to an ODBC provider will be interpreted in the standard of the provider. This is called "native" SQL. You must use the function names that the ODBC provider specifies. This means that an SQL query to a Excel driver will have to be different than a query to an SQL Server.

One way around this is to use an escape sequence. This wraps around an ANSI standard function. The ODBC provider will then translate the enclosed function into its own syntax. An example is below:

Select {fn Current_Date()}

You may find it simplest just to use the specific functions for your ODBC provider.