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 |
|
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2010-03-26 : 11:21:12
|
| Dear All,I have one table in which i have 100000 with four column o1,o2,o3,o4Suddenly i got to know that some vcalues are haveing sapce likeA1 A1 A1Request all of you to tell me how to remove these space from SQL Server |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-03-26 : 11:24:21
|
What are the data types?And where in your given example are the spaces?normally if you have trailing spaces in a varchar colum you can do this:update tableset column = rtrim(column)RTRIM() deletes trailing spaces. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-26 : 11:24:54
|
| use REPLACE(yourfield,' ','') to remove space------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2010-03-26 : 11:36:28
|
| I have tried ltrim, rtrim but still facing same thingData types are c=varchar |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-03-26 : 11:51:38
|
We still cannot see where are the spaces in your given example. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2010-03-26 : 11:52:40
|
| Data is coming like this'A1'' A2'' A3' |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-27 : 02:28:37
|
quote: Originally posted by sanjay5219 Data is coming like this'A1'' A2'' A3'
May be its having hard space. try this tooupdate tableset column =ltrim(rtrim(replace(column , char(160), char(32)))) ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|