More Delays

  • Steve Jones - SSC Editor

    SSC Guru

    Points: 721381

    Comments posted to this topic are about the item More Delays

  • SADSAC

    SSCrazy

    Points: 2087

    There are actually 2 different, but related, errors:

    The date is included in the literal;

    the time contains a letter "p" that is not recognised;

    therefore, answers 2 and 3 are equally valid

  • aklt

    SSC Veteran

    Points: 233

    From the Microsoft docs link.

    Dates can't be specified, so the date part of the datetime value isn't allowed. time_to_execute is formatted as hh:mm[[:ss].mss] and can optionally include the date of 1900-01-01.

    Now I just find this fun. Can Microsoft please make up their mind 🙂

  • Sean Lange

    SSC Guru

    Points: 286536

    SADSAC wrote:

    There are actually 2 different, but related, errors:

    The date is included in the literal;

    the time contains a letter "p" that is not recognised;

    therefore, answers 2 and 3 are equally valid

    Agreed. There are two right answers. Sadly I chose the wrong correct answer.

    Good question Steve. I have been enjoying the questions on lessor used topics over the last couple of months.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • MilesC

    Ten Centuries

    Points: 1078

    Totally agree that there are two correct answers and sadly I choose the wrong correct answer, as well.

  • Stewart "Arturius" Campbell

    SSC Guru

    Points: 71932

    Glad I wasn't online to answer this one yesterday.

    thanks for the question, Steve, had to think a bit before answering...

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    “libera tute vulgaris ex”

  • Scott Coleman

    One Orange Chip

    Points: 27446

    The question is "What happens when I run this code?".  The error I get is

    Msg 148, Level 15, State 1, Line 5

    Incorrect time syntax in time string '2020-01-10 1:13.' used with WAITFOR.

    So the only correct answer is "An error occurs because the time is formatted wrong".

    Yes, it would get the date error if it didn't have a problem with the time, but that not what happens when I run the code.

  • Jeff Moden

    SSC Guru

    Points: 997311

    I agree with the others on this, especially Scott.  It reports a problem with the time being formatted incorrectly whether or not it includes the date or not.  But, going by the question, there are two correct answers as to what the cause of the error is.  Heh... this is why I hate tests.

    If this question were actually on a qualification, university, or interview test, I'd go to the wall for my handwritten answer of "Both B and C" because you actually need to fix both for it to not produce an invalid time error.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply