SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 If condition using or
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cplusplus
Aged Yak Warrior

540 Posts

Posted - 05/07/2009 :  06:08:25  Show Profile  Reply with Quote
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 - 05/07/2009 :  09:01:33  Show Profile  Reply with Quote
yes, it's correct
Go to Top of Page

Transact Charlie
Flowing Fount of Yak Knowledge

United Kingdom
3451 Posts

Posted - 05/07/2009 :  11:50:08  Show Profile  Visit Transact Charlie's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000