Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ordering
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Divers
Thread ID:
00544830
Message ID:
00546146
Vues:
22
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform