Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
hwood125
Starting Member
12 Posts |
Posted - 2008-10-17 : 09:16:53
|
Is there anyway to change the System Date of only a database instead of changing the System Date on the server where it would effect all of the databases on a server?I am testing something in the future on one database but if I change the date I don't want it to affect the other databases and what other users may be doing. |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-10-17 : 10:38:04
|
In SELECT use something likeSELECT GETDATE()+10MadhivananFailing to plan is Planning to fail |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-17 : 10:43:06
|
if you just need datepart alone remember to strip off time before addition else the result get will be having timepart as time when you run this.SELECT DATEADD(dd,DATEDIFF(dd,0,GETDATE())+10,0) |
|
|
hwood125
Starting Member
12 Posts |
Posted - 2008-10-17 : 11:20:41
|
That won't change the system date when another application accesses the Server. I need it to change the system date so my application will have the new date time stamp and when I'm done I can set it back. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-17 : 11:29:15
|
quote: Originally posted by hwood125 That won't change the system date when another application accesses the Server. I need it to change the system date so my application will have the new date time stamp and when I'm done I can set it back.
you mean you need the change the value in table? then use UPDATE table SET value=... |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-10-17 : 12:44:29
|
SQL Server gets it's time from the operating system, so if you want to change the time, the only way to do it is change the system time.If this is something that you really need to test, you will have to setup SQL on another host. It might be easier to do it in a virtual machine.CODO ERGO SUM |
|
|
|
|
|