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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 string ' ', not sure what is this

Author  Topic 

waterduck
Aged Yak Warrior

982 Posts

Posted - 2012-06-13 : 04:53:08
Hi all,

value in column is 'abc '

most of the spaces in my db is
0x000000000000000000000000000000000000000000000000000000000000(binary)

but i happen to have
0xA00000000000000000000000000000000000000000000000000000000000(binary)

may i know what is this spaces? rtrim, ltrim with reverse, replace wouldn't work for me.

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-06-13 : 04:55:21
'abc' sounds like a string whereas your columns are binary?
Not sure what your issue is or where the 0xa0 value comes in.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2012-06-13 : 04:56:52
you notice the last spacing in 'abc '<--
i convert the space into binary value.
ASCII was 160.
Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2012-06-13 : 05:03:52
lol....replace(column, char(160), '') works.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-13 : 10:29:21
char(160) is hard space or Non breaking space which cannot be removed using LTRIM,RTRIM functions

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2012-06-14 : 05:15:48
why need such thing as char(160)? it just causing problems!!
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-06-14 : 05:25:45
It prevents line breaks being inserted in the string when displayed.
SQL Server doesn't support utf-8 which is generally used for other systems and is a much larger character set so there are conversion issues.

In fact Microsoft have removed utf-8 conversion support from some utilities just to make it more difficult.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -