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 |
niranjankumark
Posting Yak Master
164 Posts |
Posted - 2008-04-03 : 10:18:39
|
In a table one column has values as000001200002140000000000000000000000000000like if any number of zero available mean i shud show 0 .Here i shud display only 7. non zero exist mean i shud show. |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-03 : 10:20:58
|
Not clear what you mean. Maybe this?Select cast(col as int) as col from table Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
Imukai
Starting Member
29 Posts |
Posted - 2008-04-03 : 10:26:12
|
or SELECT CONVERT(int,columnname) FROM Table If you wanted just the 0 ones then:SELECT CONVERT(int,columnname) FROM Table WHERE CONVERT(int,columnname) = 0 |
 |
|
niranjankumark
Posting Yak Master
164 Posts |
Posted - 2008-04-03 : 10:31:05
|
In a table one column has values as00000120000214000000000000000000000000000.. RESULT SHUD SHOW AS0000000rows which is having more than 0 ( even one number ex : 0000012 ) it shud not display.got it ????ur qry will display 12214000000 |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-03 : 10:36:07
|
[code]Select case when col like '0%' then 0 else col end as colfrom table[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|