Strange syntax in where clause

Below is a simplified version of the request sent by the reporting tool to our database. I have never seen this syntax before in a Where clause. Can someone tell me what the brackets do? And, I suppose that "d" acts as a cast date?

Select
    ch.ContainerID, 
    ch.WorkItemHistoryEventTypeEnumID,
    ch.EventTime,
    ch.ContainerBinName,
    ch.WorkItemSerialNumber,
    ch.Closed
From Wip.vwContainerHistory ch
Where   
   ch.EventTime >= {d '2010-08-09'} 
+5
source share
2 answers

See "Supported String Literature Formats for Date and Time" in the MSDN datetime article .

Yours {d 'XXXX-XX-XX'}is the ODBC date and time format. ODBC temporary escape sequences have the format { literal_type 'constant_value' }::

literal_type indicates the type of escape sequence. Timestamps have three literal_type qualifiers:

  • d =
  • t =
  • ts = timestamp ( + )

'constant_value' - escape-. constant_value literal_type.

d > yyyy-mm-dd  
t > hh:mm:ss[.fff]  
ts > yyyy-mm-dd hh:mm:ss[.fff]
+10

escape- ODBC . . http://msdn.microsoft.com/en-us/library/ms187819.aspx

  • d =
  • t =
  • ts = timestamp ( + )
+3

All Articles