Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can I use the case statement ?
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00596736
Message ID:
00596747
Vues:
18
I figured out that Case is not a flow control thing here in SQL like VFP, but more like a IIF statement. I found out I can use the IF statement to do what I want. But I don't know if this is the optimized was to do it.
CREATE PROCEDURE ct_UserAuditListing 
@tiUserID int,
@tcAction varchar(30)

--tiUserID=0 we want all users
--tcAction="ALL" we want all actions

as
IF @tiUserID>0 and @tcAction='ALL' 
	select * from  coAudit where UserID=@tiUserID
IF @tiUserID=0 and @tcAction='ALL'
	select * from coAudit
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform