Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Case in Where clause
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01303803
Message ID:
01303817
Views:
16
>Hi Sergey, I need the case in the Where clause not the set, the same fields will always be updated with the same values , what I have is a table containing a customer number and a master customer number, if @MyFlag = 'Y' then I want to update all records for that master , i.e my where clause would be: "Where MasterNumber = @MasterNumber" otherwise the where clause would be:"Where CustomerNo = @CustomerNo" which would only update one record - thanks a lot

It's not even close to your original post. Anyway, I'm not sure why it has to be in where clause
IF @MyFlag = 'Y'
	update mytable
		SET fieldx = NULL
		WHERE MasterNumber = @MasterNumber
ELSE
	update mytable
		SET fieldx = NULL
		WHERE CustomerNo = @CustomerNo
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform