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 |
|
Elmo5621
Starting Member
2 Posts |
Posted - 2009-10-06 : 09:40:57
|
| Hi all,It is a long long time since I did any SQL and am looking for general information on how to achieve the following, I am guessing a stored proc- I have a table with two dates, create date and maint date and guid- I would like to read through the whole take and fing all records that were created today- Once I have those I would like to update another table with the maint date where the two guids are equal- I would like to run this on a regular basis i.e 04:00 but also have the ability to execute on the fly Thanks in advance |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-10-06 : 10:07:39
|
| UPDATE dtSET maintDate = s.mainDateFROM DestinationTable dINNER JOIN SourceTable sON d.guid = s.guidWHERE s.CreateDate >= dateadd(day,datediff(day,0,getdate()),0)and s.CreateDate < dateadd(day,datediff(day,0,getdate()),1)JimEveryday I learn something that somebody else already knew |
 |
|
|
Elmo5621
Starting Member
2 Posts |
Posted - 2009-10-06 : 10:12:53
|
| Thanks Jim,That seems a lot easier than I seem to remember, will give that a tryCheers |
 |
|
|
|
|
|