Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is {ts '2013-04-02 00:00:00'}?

when i analyzing running T-SQL I found a query that have {ts '2013-04-02 00:00:00'} in where clause. i was so curious about this and tried to find the source. It was executed by a CrystalReport Report.

here is the query.

SELECT *
FROM    [Table] B
WHERE   CONVERT(VARCHAR, [AddedDateTime], 111) 
        BETWEEN CONVERT(VARCHAR, {ts '2013-03-31 00:00:00'}, 111)
        AND     CONVERT(VARCHAR, {ts '2013-04-02 00:00:00'}, 111)

Can anyone tel me what is it and where we can use it?

like image 923
SAM Avatar asked Apr 02 '13 08:04

SAM


People also ask

What does TS mean in SQL query?

Developers describe TS-SQL as "A SQL database implemented purely in TypeScript type annotations". It is a SQL database implemented purely in TypeScript type annotations This means that it operates solely on types - you define a "database" (just a type annotation) and then query it using some more type annotations.

How do I do a timestamp in SQL?

The basic syntax of “timestamp” data type in SQL is as follows : Timestamp 'date_expression time_expression'; A valid timestamp data expression consists of a date and a time, followed by an optional BC or AD.


1 Answers

It's an ODBC literal escape sequence

ODBC defines escape sequences for date, time, and timestamp literals. The syntax of these escape sequences is as follows:

{ts 'value'}

where we can use it?

Anywhere where a datetime value is expected. ("timestamp" is SQL Standard vernacular for what SQL Server calls datetime).

like image 149
Damien_The_Unbeliever Avatar answered Oct 24 '22 09:10

Damien_The_Unbeliever