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 |
|
rookie_sql
Constraint Violating Yak Guru
443 Posts |
Posted - 2007-11-29 : 10:15:15
|
| Hi i've a column which is getting a extra 0 at the start of it is there a way to remove this extra 0,I know its the first 0 but i do not know the full lenght of the digit that in the column. Example Col101000020000032200122 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-11-29 : 10:35:40
|
| select substring( columnName, 2, len(columnName))orselect RIGHT ( columnName, len(columnName) - 1 )_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2007-11-29 : 10:39:03
|
| select substring(col1,2,len(col1)) as Col1 |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2007-11-29 : 10:42:15
|
| Damn, I go away and do some work and then get snipped. |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-11-29 : 10:47:00
|
_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-11-30 : 01:49:40
|
quote: Originally posted by rookie_sql Hi i've a column which is getting a extra 0 at the start of it is there a way to remove this extra 0,I know its the first 0 but i do not know the full lenght of the digit that in the column. Example Col101000020000032200122
If you meant to remove leading zeroes then select cast(col as int) from tableprovided col has no non-numeric charactersMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|