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 |
|
u2envy1
Yak Posting Veteran
77 Posts |
Posted - 2007-06-01 : 06:21:14
|
| How do I go about in changing the row value in a SELECT query.Eg. If I have a row Status. If that row returns Number like 1,2,3,4,5, & 6. When I do the Select query. All rows that return 1 must have a value of Canceled, 2= OnHold, 3= InQuery & so on.How can this be done in SQL 2000 |
|
|
bpgupta
Yak Posting Veteran
75 Posts |
Posted - 2007-06-01 : 07:46:47
|
| select case status when 1 then 'cancelled'when 2 then 'onhold'when 3 then 'Inquery'---Else 'Nothing'from tablename |
 |
|
|
pbguy
Constraint Violating Yak Guru
319 Posts |
Posted - 2007-06-01 : 07:54:27
|
| row is returning numbers???? do you mean comma separated valuespost some and data and required output--------------------------------------------------S.Ahamed |
 |
|
|
u2envy1
Yak Posting Veteran
77 Posts |
Posted - 2007-06-01 : 08:11:00
|
| row is returning numbers.SELECT * FROM StatusRETURN--------UserID Current_StatusJohn 1Peter 2Paul 3It should returnUserID Current_StatusJohn CancelledPeter OnHoldPaul InQuery |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-01 : 08:16:03
|
quote: Originally posted by bpgupta select case status when 1 then 'cancelled'when 2 then 'onhold'when 3 then 'Inquery'---Else 'Nothing'endfrom tablename
MadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-01 : 08:18:51
|
quote: Originally posted by u2envy1 row is returning numbers.SELECT * FROM StatusRETURN--------UserID Current_StatusJohn 1Peter 2Paul 3It should returnUserID Current_StatusJohn CancelledPeter OnHoldPaul InQuery
You can use modified code of pbguptaMadhivananFailing to plan is Planning to fail |
 |
|
|
u2envy1
Yak Posting Veteran
77 Posts |
Posted - 2007-06-01 : 08:54:46
|
| Thanks peeps |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-01 : 09:01:23
|
quote: Originally posted by u2envy1 Thanks peeps
Does this mean "Thanks People"?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|