ODBC Escape Sequences

To setup default values ODBC Escape Sequences can be used. ODBC defines a number of escape sequences of which we can use the literal and scalar function escape sequence.

An ODBC escape sequence is enclosed in curly brackets {}. The escape sequence is recognized by SQL Server and translated into the SQL Server equivalent.

Literals

The ODBC literal escape sequence is used to define date, time and datetime literals. These are defined by using {literaltype ‘literal’}. The following literal types are defined:


Type

Meaning

Format of Value

 

d

Date  

 yyyy-mm-dd

t

Time  

 hh:mm.ss

ts

Timestamp  

yyyy-mm-dd hh:mm:ss

 

Scalar Functions

The ODBC scalar function escape sequence is used to define a function call to a scalar function. A scalar function returns a value for every row. Function calls are defined by using {fn scalar-function}. Several different types of functions have been defined: string functions, numeric functions, date time functions, system functions and data type conversion functions.

 

See Also

Connectivity Concepts