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 |
|
thegurutobe
Starting Member
2 Posts |
Posted - 2007-08-20 : 08:24:01
|
| Hi,I am using the following trigger but it seems to do the second update and not the first update.CREATE TRIGGER [PREPSTATUSCOMPLETE] ON [dbo].[PrepLog]FOR UPDATEASIF EXISTS(SELECT FINISHTIME FROM PREPLOG WHERE FINISHTIME = '---')UPDATE RMJOBSET PSTATUS = 'PREPPING' FROM RMJOB,PREPLOG WHERE PREPLOG.FINISHTIME = '---'AND RMJOB.RMJOBID = PREPLOG.RMJOBIDIF EXISTS(SELECT FINISHTIME FROM PREPLOG WHERE FINISHTIME != '---')UPDATE RMJOBSET PSTATUS = 'PREPPING COMPLETE' FROM RMJOB,PREPLOG WHERE PREPLOG.FINISHTIME != '---'AND RMJOB.RMJOBID = PREPLOG.RMJOBIDThe first update does not get triggered but the second update gets triggered as soon as the if condition is meant.Can somebody please help me on this?A. |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-08-20 : 22:06:52
|
| That means first condition check failed. Did you double check values in source table? |
 |
|
|
thegurutobe
Starting Member
2 Posts |
Posted - 2007-08-21 : 10:33:58
|
| Yes the values in the source table are ok |
 |
|
|
|
|
|