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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Update Proc

Author  Topic 

dbuerger
Starting Member

2 Posts

Posted - 2009-11-12 : 17:17:49
I'm very new with writing queries and procs for SQL 2005

I'm create and site for our Demo Customers, with fake data, which I was always to be up-to-date

So I was hoping to create a proc to run weekly and update all the date fields to be +7 days.

Is this possible, if so how

Thanks in advanced
Drew

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-11-12 : 19:22:41
We have a SQL job like that for our demo system.

You simply run UPDATE statement for each table you want to update. Here's an example:

UPDATE Table1
SET SomeDateTimeColumn = DATEADD(d, 7, SomeDateTimeColumn)

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

dbuerger
Starting Member

2 Posts

Posted - 2009-11-13 : 10:13:47
Perfect, Thanks!
Go to Top of Page
   

- Advertisement -