Monday, March 19, 2012

How can change retrieved data in storedProcedure

Hello,

I have a small problem,

I have table:

data
---
id | er|
----
1 | 4|
2| 5|

I would like to retrevied this data, which is simply easy
select * from data,

but at the same time i would lket to change er values to strings : 4= OK, 5=BAD , that the query would return :

data
---
id | er|
----
1 | OK|
2| BAD|

but database would stay unchanged...

any ideas? is it possible at all?Question moved to SQL Server forum|||use CASE statment for the purpose.|||Try this:

select id,
case when er = 4 then 'OK'
when er = 5 then 'BAD'
else ''
End ER
from data

No comments:

Post a Comment