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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-07-10 : 09:16:40
|
| sa writes "what SQL should i write to right pad ZERO's from my list. Output of my table 00123304050012030404040000233440012133300933required output 1233040501203040404233440012133300933It should only suppress Zero's on the left Thanks in advance" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-10 : 09:20:09
|
| select convert(varchar(20),convert(int,col))from tblselect case when left(col,1) = '0' then right(col,len(col) - patindex('%[^0]%',col + 1) else col endfrom tbl==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-07-10 : 09:20:30
|
| If your table contains just numeric data, you can try following:select convert(int,convert(varchar(30), col1)) from sometableHarsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-07-10 : 09:22:44
|
| If you use front end application, do formation thereMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|