Curly braces in T-SQL Curly braces in T-SQL sql-server sql-server

Curly braces in T-SQL


These are ODBC escape sequences. See Date, Time, and Timestamp Escape Sequences for more details.

There is also similar syntax for uniqueidentifiers

SELECT {guid '00000000-0000-0000-0000-000000000000'},

as well as procedure calls and some other constructs detailed off that link.

With regard to the rest of your question I'm not aware of any way of having an integer literal treated as a bigint or of any particular resource that lists all the ways of influencing how literals are assigned datatypes by SQL Server. Some ways are below.

;WITH cte(thing) AS(SELECT CAST(1 AS SQL_VARIANT) UNION ALLSELECT $1 UNION ALLSELECT 1e0 UNION ALLSELECT 1.0000 UNION ALLSELECT 2147483648 UNION ALL SELECT {ts '2011-09-15 01:23:56.123'}  UNION ALLSELECT {d '2011-09-15'} UNION ALLSELECT { t '13:33:41' }  UNION ALLSELECT {guid '00000000-0000-0000-0000-000000000000'} UNION ALLSELECT 'Foo' UNION ALLSELECT N'Foo')SELECT thing,        sql_variant_property(thing,'basetype') AS basetype,       sql_variant_property(thing,'precision') AS precision,        sql_variant_property(thing,'scale') AS scale,        sql_variant_property(thing,'maxlength') AS maxlengthFROM cte

Returns

thing                          basetype            precision   scale  maxlength------------------------------ ------------------- ----------- ------ ---------1                              int                 10          0      41.00                           money               19          4      81                              float               53          0      81.0000                         numeric             5           4      52147483648                     numeric             10          0      52011-09-15 01:23:56.123        datetime            23          3      82011-09-15 00:00:00.000        datetime            23          3      82011-09-15 13:33:41.000        datetime            23          3      800000000-0000-0000-0000-000000 uniqueidentifier    0           0      16Foo                            varchar             0           0      3Foo                            nvarchar            0           0      6