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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Conversion of int to char

Author  Topic 

coolguyren4u
Starting Member

12 Posts

Posted - 2011-05-31 : 02:15:24
Hi,
How can i convert the data from a integer datatype to a char data type and check the fields.
The sample Output i need is shown below.
In that i have Blocked column with integer. I want to convert the integers into the following character.
Your help is appreciated!!!


Blocked (Int) Blocked (Char)
0 No
1 Ship
2 Invoice
3 ALL
0 No

coolguyren4u
Starting Member

12 Posts

Posted - 2011-05-31 : 02:19:22
Blocked (int)
0
1
2
3
0
Go to Top of Page

coolguyren4u
Starting Member

12 Posts

Posted - 2011-05-31 : 02:20:17
O/p For the above table

Blocked (char)
No
Ship
Invoice
ALL
No
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-05-31 : 02:42:11
[code]
select case blocked
when 0 then 'No'
when 1 then 'Ship'
when 2 then 'Invoice'
when 3 then 'ALL'
end
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -