Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Unable to delete space\Special char from Varchar
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

11 Posts

Posted - 07/01/2013 :  16:06:59  Show Profile  Reply with Quote
Hello All,
I have few rows in the address table with spaces(Leading\trail) which is being interpreted as special characters by the application. I have tried to delete those spaces using the below statement but had no success
SET ADDRESS1=Ltrim(rtrim(Address1))
Also if possible please let me know why the extra space is interpreted as '-' in sql server management studio.

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 07/01/2013 :  16:45:47  Show Profile  Reply with Quote
That update should work if in fact the leading/trailing characters were spaces. So that means they are something else - some other non-printable characters. There is no one easy way to remove such non-printable characters. See here for example.

You can also cast the column to varbinary to see what the characters actually are:
select cast(Address1 as varbinary) from Addr
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000