Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-08-11 : 08:27:59
|
sandip writes "hi friends, will u please tell me the syntax of case statement in stored procedure . it's urgent thanks Sandip" |
|
druer
Constraint Violating Yak Guru
314 Posts |
Posted - 2006-08-11 : 08:36:55
|
From books on line:CASE input_expression WHEN when_expression THEN result_expression [ ...n ] [ ELSE else_result_expression ] END SELECT 'Price Category' = CASE WHEN price IS NULL THEN 'Not yet priced' WHEN price < 10 THEN 'Very Reasonable Title' WHEN price >= 10 and price < 20 THEN 'Coffee Table Title' ELSE 'Expensive book!' END, CAST(title AS varchar(20)) AS 'Shortened Title'FROM titlesORDER BY priceHope it helps,DaltonBlessings aren't so much a matter of "if they come" but "are you noticing them." |
 |
|
|
|
|