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)
 If condition using or

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2009-05-07 : 06:08:25
I am trying to use the following if condition is this the right way using Or..

If @ExistingCriticalItem <> @NextCriticalActionItem or @RecCount = 1
BEGIN
UPDATE TABleActions set CRITICAL = '0' where ModuleRecordID=@ModuleRecordID
AND ModuleName = @ModuleName

UPDATE TABLeActions
SET
Critical = '1'
WHERE ActionID = @NextCriticalActionItem
END




Thank you for the helpful info.

whitefang
Enterprise-Level Plonker Who's Not Wrong

272 Posts

Posted - 2009-05-07 : 09:01:33
yes, it's correct
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-05-07 : 11:50:08
Well.... correct?.....

It's syntactically complete and logical.

Whether it's correct or not we have no way to know.

Is the UPDATE doing what you wanted it to do?


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -