Subject: System Date
Posted By: adyaky Post Date: 1/6/2006 3:01:57 AM
Hi to all,


  Good day to all! Just one question
  How can I change the System date of the SQl server using SQL script, sql function/procedure or sql commands?

Thanks
adyaky
Reply By: Anantsharma Reply Date: 1/6/2006 4:46:58 AM
You can use XP_CMDSHELL from Query Analyzer / your app to execute an executable which will change System date. This executable may be a C module.



B. Anant
Reply By: David_the_DBA Reply Date: 1/6/2006 5:46:53 PM
Anantsharma is on the right track, as xp_cmdshell is the way to go. Although there is no need to write a C Module when the command shell (Windows -- even back to DOS) provides a command to change the date
EXEC xp_cmdshell 'date 02-01-06' -- This will change the Date on the SQL Server

-- CMD line command date [MM-DD-YY[YY]]

David Lundell
Principal Consultant and Trainer
www.mutuallybeneficial.com

Go to topic 37662

Return to index page 401
Return to index page 400
Return to index page 399
Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395
Return to index page 394
Return to index page 393
Return to index page 392