Revision: 43199
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 18, 2011 21:45 by samwa
Initial Code
DECLARE @SortOrder tinyint SET @SortOrder = 2 SELECT CompanyName, ContactName, ContactTitle FROM Customers ORDER BY CASE WHEN @SortOrder = 1 THEN CompanyName WHEN @SortOrder = 2 THEN ContactName ELSE ContactTitle END
Initial URL
http://www.sqlteam.com/article/dynamic-order-by
Initial Description
Initial Title
sql order by with case
Initial Tags
sql, order
Initial Language
SQL