Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ordering
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Miscellaneous
Thread ID:
00544830
Message ID:
00546146
Views:
17
>I've tried several variations and I still can't get it working. I've also looked in my SQLServer books as well as BOL, but I can't figure this out. I'm sure its a stupid little goofy typo on my part, but would you mind sending me a "very simple" complete select statement using the case idea when you get a chance.


Here's a very simple example that works off the Pubs database:

USE pubs
DECLARE @orderby varchar(10)
SET @orderby='city'

SELECT au_lname, au_fname, city
FROM authors
ORDER BY CASE
WHEN @orderby='last' THEN au_lname
WHEN @orderby='first' THEN au_fname
WHEN @orderby='city' THEN city
END

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform