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 |
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2009-06-19 : 16:57:06
|
| Column1 is of Varchar(2) database:case WHEN Column1 ='00' then NULL WHEN Column1 ='0' then NULL WHEN Column1 ='1' then 'P1' else Column1 end as Column1I am unable to convert if the value '00' to null with above query.Please help |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-06-19 : 17:56:29
|
Sure?declare @column1 varchar(2)set @column1='00'selectcase when @column1 = '00' then null WHEN @Column1 ='0' then NULL WHEN @Column1 ='1' then 'P1' else @Column1 end as Column1 works No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-20 : 02:03:37
|
| [code]CASE WHEN NULLIF(@column1*1,0) IS NULL THEN NULL WHEN NULLIF(@column1*1,0) =1 THEN 'P1' ELSE @column1END[/code] |
 |
|
|
|
|
|