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 |
DiceK-BadMan
Starting Member
12 Posts |
Posted - 2008-03-26 : 19:10:04
|
hican i ask if what function should i used about my problem..If i have a column of PHONE and the content of it for example is like this000000000054154000000000946546500000000000000000000000005415400000000094654650000000000000000000000000000541540000000009465465000000000000000541540000000009465465000000000000000000how can I remove those zeros left and right?noticed that the length are not equal. AND The zeros in the center will still remain.what query or function should i used?..thanks |
|
Koji Matsumura
Posting Yak Master
141 Posts |
Posted - 2008-03-26 : 23:50:27
|
DECLARE @T TABLE (F varchar(50))INSERT INTO @T SELECT '000000000054154000000000946546500000000000000000'UNION ALL SELECT '000000005415400000000094654650000000000000000000'UNION ALL SELECT '0000000005415400000000094654650000000000'UNION ALL SELECT '00000541540000000009465465000000000000000000'SELECT F, REPLACE(LTRIM(RTRIM(REPLACE(F, '0', ' '))), ' ', '0') FROM @T |
 |
|
DiceK-BadMan
Starting Member
12 Posts |
Posted - 2008-03-27 : 08:14:58
|
Thanks for the answer,it really help me a lot. |
 |
|
|
|
|