Delaying the code

  • Comments posted to this topic are about the item Delaying the code

  • Nice question, thanks Steve.

    ...

  • between "WAITFOR DELAY '00:02.5':ย  and "WAITFOR DELAY '00:02:00.5'" is the big difference

  • Had to double check that one before I confirmed my answer; trying to be tricky with the first questions of the year, are we Steve? ๐Ÿ˜‰

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • BWAAAA-HAAAA-HAAAA!!!!ย  I'm thinking that this question is the result of someone learning something the hard way! ๐Ÿ˜€ ๐Ÿ˜€ ๐Ÿ˜€

    Great "gotcha" question, Steve!

    --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.


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

  • Not trying to be too tricky, but just struggling to come up with answers that might be plausible, or be easy mistakes to make. I haven't actually done this, mostly because I test the heck out of anything where I use this because I worry I'll format time wrong.

    This code would never get edited in production without being tested somewhere.

  • Right there with you on the "test the heck out of anything".

    To be absolutely honest, I have no idea how you even came across this especially since it's not a documented time format (at least not one I've come across before).ย  That makes it an even greater question.

    --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.


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

  • Back in the land of the connected (spent the last 2 weeks in the bush, in the middle of nowhere (no mobile connectivity)).

    Nice reminder of the intricacies of the TIME datatype (especially the undocumented ones), thanks Steve

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    โ€œlibera tute vulgaris exโ€

  • Stewart "Arturius" Campbell wrote:

    Back in the land of the connected (spent the last 2 weeks in the bush, in the middle of nowhere (no mobile connectivity)).

    Nice reminder of the intricacies of the TIME datatype (especially the undocumented ones), thanks Steve

    The varchar passed for WAITFOR isn't parsed as a time (or at least the SQL Server version of it).ย  The value '00:02.5' results in a conversion error if you try to convert it (to a time), due to it missing the seconds before you get to the milliseconds:

    SELECT CONVERT(time(1),'00:02.5') AS Delay;

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

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

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