Set Date & Time to Fixed

  • I want to setting date&time of sql server 2008 fixed to exec unit test.

    How to set date & time in sql server 2008 to fixed ?

    Pls, help me

  • What do you mean 'fixed'? :unsure:

  • Paul, I guess he is asking "how to permanently change dateformat of the server until his unit tests are over and then change back to original"..:-)

  • Paul White NZ (5/21/2010)


    What do you mean 'fixed'? :unsure:

    select CONVERT(CHAR(8),GETDATE(),112)

    select CONVERT(CHAR(8),GETDATE(),8)

    result:

    --------

    20100521

    --------

    18:27:51

    I want at any time when run code then always for above result.

    sorry for late reply

    Pls, help me.

    Thanks

  • nguyennd (5/21/2010)


    I want any time when run code then always for above result.

    The only way I can think of to do this is to change the date and time on the server hosting SQL Server to just before that date and time (say 2010-05-21 18:27:00) and then use a WAITFOR TIME '18:27:51' statement just before the thing you want to test.

    Doesn't seem like a good idea to me though - perhaps you should consider rewriting the unit test to be more flexible. After all, it is unlikely to always be 2010-05-21 18:27:51 in the real world 🙂

  • Thanks Paul,

    I trying to setting DATE&TIME on my computer to fixed, but i can not setting for TIME.

    I do that becasue i want to run auto test. If can not, I must to exec manual test. Capture result test to prove the results are correct.

    As you say:

    How to use WAITFOR TIME..........?

    Sorry for late reply.

    My english is not good.

Viewing 6 posts - 1 through 5 (of 5 total)

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