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 |
pascal_jimi
Posting Yak Master
167 Posts |
Posted - 2013-06-24 : 01:42:43
|
declare @table3 table(phone2 int) -- insert into @table3 values(111111)insert into @table3 values(222222)insert into @table3 values(333333)insert into @table3 values(444444)insert into @table3 values(555555)insert into @table3 values (666666)SELECT CASE WHEN Phone2 between 111111 and 333333 then 'A'END as Phone2from @table3result query------Phone2AAAnullnullnull----how can I get a resulting table soPhone2AAA444444555555666666kmkmmm |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-06-24 : 01:44:06
|
you need a else to handle other valuesSELECT CASE WHEN Phone2 between 111111 and 333333 then 'A' else CAST(Phone2 AS varchar(10)) END as Phone2from @table3 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
pascal_jimi
Posting Yak Master
167 Posts |
Posted - 2013-06-24 : 01:47:36
|
Request completed with errorkmkmmm |
|
|
pascal_jimi
Posting Yak Master
167 Posts |
Posted - 2013-06-24 : 01:48:36
|
sorry thak you for help kmkmmm |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-06-24 : 01:48:51
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|