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 |
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2008-08-05 : 02:56:42
|
| I have the following code however it does not work. I select the last row in a table (this works) and then depending on the value of the InterActionFlag field value(busy or ready) do the following. If ready update InterActionFlag to busy, if busy wait until it is ready.ALTER PROCEDURE dbo.Update1ASBEGIN /* SET NOCOUNT ON */SELECT PutToArchiveID, PutToArchiveProgressStatus, PutToArchiveStartTime, PutToArchiveEndTime, IsolationTimePoint, MakeVCReadOnlyTime, StopVCTime, RestartVCTime, InterActionFlag,CASEWHEN InterActionFlag = 'Ready'THEN UPDATE VCLog.dbo.PutToArchiveLog SET VCLog.dbo.PutToArchiveLog.InterActionFlag='BUSY'WHEN InterActionFlag = 'Busy'THEN WaitENDFROM (SELECT PutToArchiveID, PutToArchiveProgressStatus, PutToArchiveStartTime, PutToArchiveEndTime, IsolationTimePoint, MakeVCReadOnlyTime, StopVCTime, RestartVCTime, InterActionFlagFROM VCLog.dbo.PutToArchiveLogWHERE PutToArchiveID IN(SELECT MAX(PutToArchiveID) FROM VCLog.dbo.PutToArchiveLog)) AS LastRowDetailsEND |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-08-05 : 03:05:33
|
| I've never heard that SQL-Statements can WAIT.What is about Trigger?Webfred |
 |
|
|
|
|
|
|
|