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 |
|
JeffT
Posting Yak Master
111 Posts |
Posted - 2006-05-08 : 12:49:33
|
| Hi,I am trying to pad a field from the left with zeros that is defined in a table as "[char] (9)". The field can have from 1 to 9 chars populated. In this instance the value in the field is "133000", which I am trying to pad so that it will be "000133000". I have made several failed attempts to do this, the latest of which was this:selectright(replicate('0',9)+ convert(varchar(9),a.GS06GRP_CTL_NBR),9) from Table1 aThanks,Jeff |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-05-08 : 13:25:00
|
| selectright(replicate('0',9)+ rtrim(ltrim(a.GS06GRP_CTL_NBR)),9) from Table1 a==========================================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. |
 |
|
|
JeffT
Posting Yak Master
111 Posts |
Posted - 2006-05-08 : 15:18:10
|
| Thanks very much nr, I will try this !Jeff |
 |
|
|
|
|
|