Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:23:34+00:00 2026-05-25T15:23:34+00:00

I’ve come across the following t-sql: SELECT {d’9999-12-31′} Which returns 9999-12-31 00:00:00.000 . This

  • 0

I’ve come across the following t-sql:

SELECT {d'9999-12-31'}

Which returns 9999-12-31 00:00:00.000.

This seems to be converting the type of the string literal to a DATETIME. I can’t find any documentation on this syntax and I’m wondering if there are any variations, for example if I have a literal 1 but want to represent this in a BIGINT without using CONVERT()/CAST().

Can anyone provide any further information on this syntax? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:23:34+00:00Added an answer on May 25, 2026 at 3:23 pm

    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 ALL
    SELECT $1 UNION ALL
    SELECT 1e0 UNION ALL
    SELECT 1.0000 UNION ALL
    SELECT 2147483648 UNION ALL 
    SELECT {ts '2011-09-15 01:23:56.123'}  UNION ALL
    SELECT {d '2011-09-15'} UNION ALL
    SELECT { t '13:33:41' }  UNION ALL
    SELECT {guid '00000000-0000-0000-0000-000000000000'} UNION ALL
    SELECT 'Foo' UNION ALL
    SELECT 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 maxlength
    FROM cte
    

    Returns

    thing                          basetype            precision   scale  maxlength
    ------------------------------ ------------------- ----------- ------ ---------
    1                              int                 10          0      4
    1.00                           money               19          4      8
    1                              float               53          0      8
    1.0000                         numeric             5           4      5
    2147483648                     numeric             10          0      5
    2011-09-15 01:23:56.123        datetime            23          3      8
    2011-09-15 00:00:00.000        datetime            23          3      8
    2011-09-15 13:33:41.000        datetime            23          3      8
    00000000-0000-0000-0000-000000 uniqueidentifier    0           0      16
    Foo                            varchar             0           0      3
    Foo                            nvarchar            0           0      6
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.