>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