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 |
|
Exir
Posting Yak Master
151 Posts |
Posted - 2008-10-26 : 06:20:31
|
| I want to write a stored procedure which when a row insert into a table a field of that row(forexample with the name of Date)be filled with the current date and time, then it start to count and when 24 hours passed from the date of data insertion, check another field(forexample with the name of support) and if that row was still null, fill other field(forexample with the name of dalay) with YES. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-26 : 06:54:29
|
1. you can use GETDATE() function to put current date value to field2. You can schedule a job in sql agent to execute the procedure periodically at a convenient time3. At any time check for condition datefield<DATEADD(hh,-24,GETDATE()) for records which was inserted 24 hrs before and look for supportname IS NULL and update delayname='YES'. so it will be likeUPDATE TableSET delayname='YES'WHERE datefield<DATEADD(hh,-24,GETDATE())AND supportname IS NULL |
 |
|
|
|
|
|