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 |
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2005-01-24 : 17:02:32
|
I have a table looks like:ID0890098608976019908 76543 I would like to get rid of spaces in front of ID and leave '0'.The output should looks like:ID089009860897601990876543 How can i do this? |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-01-24 : 17:06:49
|
| see ltrim in bol.==========================================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. |
 |
|
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2005-01-24 : 17:10:36
|
| I’ve used ltrim function ,but it doesn’t recognized as spaces. What could be the reason? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-01-24 : 17:15:25
|
It works with LTRIM, perhaps your data is different:DECLARE @ID varchar(10)SET @ID = ' Tara'PRINT @IDPRINT LTRIM(@ID) Tara |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-01-24 : 17:25:10
|
| Sounds like it's not a spacetryselect substring(ID, patindex('%[0-9]%',ID), 20)from 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. |
 |
|
|
|
|
|