SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Future System Date
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

hwood125
Starting Member

12 Posts

Posted - 10/17/2008 :  09:16:53  Show Profile  Reply with Quote

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

India
22755 Posts

Posted - 10/17/2008 :  10:38:04  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
In SELECT use something like

SELECT GETDATE()+10

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 10/17/2008 :  10:43:06  Show Profile  Reply with Quote
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)
Go to Top of Page

hwood125
Starting Member

12 Posts

Posted - 10/17/2008 :  11:20:41  Show Profile  Reply with Quote
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.

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 10/17/2008 :  11:29:15  Show Profile  Reply with Quote
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=...
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

USA
7020 Posts

Posted - 10/17/2008 :  12:44:29  Show Profile  Reply with Quote
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000