Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Case in Where clause
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01303803
Message ID:
01303817
Vues:
17
>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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform