May 21, 2010 at 4:35 am
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
May 21, 2010 at 4:41 am
What do you mean 'fixed'? :unsure:
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
May 21, 2010 at 4:47 am
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"..:-)
May 21, 2010 at 5:38 am
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
May 21, 2010 at 5:49 am
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 🙂
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
May 21, 2010 at 6:08 am
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