Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can I use the case statement ?
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00596736
Message ID:
00596747
Views:
17
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform