﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / Development  / Removing trailing spaces in a table column / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 23 May 2013 20:22:21 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Removing trailing spaces in a table column</title><link>http://www.sqlservercentral.com/Forums/Topic445783-145-1.aspx</link><description>I used following to remove only trailing white spaces in a CHAR(30) column:RTRIM(LTRIM(CAST(City_Id As VARCHAR(30)))) AS City_IdPiyush Varma</description><pubDate>Wed, 03 Oct 2012 12:49:00 GMT</pubDate><dc:creator>piyush.varma</dc:creator></item><item><title>RE: Removing trailing spaces in a table column</title><link>http://www.sqlservercentral.com/Forums/Topic445783-145-1.aspx</link><description>SELECT ASCII(SUBSTRING(Col1, n, 1))</description><pubDate>Tue, 14 Jun 2011 10:05:55 GMT</pubDate><dc:creator>SwePeso</dc:creator></item><item><title>RE: Removing trailing spaces in a table column</title><link>http://www.sqlservercentral.com/Forums/Topic445783-145-1.aspx</link><description>Can you advise as to how you fixed the issue and how you knew it was a CR/LF.  We are having the same issue when loading mainframe data into our systems and an RTRIM is not working.  Thanks.</description><pubDate>Tue, 14 Jun 2011 09:44:55 GMT</pubDate><dc:creator>bwieland</dc:creator></item><item><title>RE: Removing trailing spaces in a table column</title><link>http://www.sqlservercentral.com/Forums/Topic445783-145-1.aspx</link><description>Hi ,Fixed the issue :-) , the trailing space was in fact a carriage return , ascci value (13) , used a replace(queryphrase,char(13),'') to fix the issue .Guess where i went wrong was assuming there could only be spaces in the column.Jay</description><pubDate>Tue, 22 Jan 2008 04:20:57 GMT</pubDate><dc:creator>Jayanth_Kurup</dc:creator></item><item><title>RE: Removing trailing spaces in a table column</title><link>http://www.sqlservercentral.com/Forums/Topic445783-145-1.aspx</link><description>LEN() function is NOT counting trailing spaces.DATALENGTH() does.Are you the spaces really are spaces (ascii value 32)?Make sure they are not hard-spaces (ascii value 160).</description><pubDate>Tue, 22 Jan 2008 02:56:53 GMT</pubDate><dc:creator>SwePeso</dc:creator></item><item><title>RE: Removing trailing spaces in a table column</title><link>http://www.sqlservercentral.com/Forums/Topic445783-145-1.aspx</link><description>Check the following link may be usefulhttp://www.thescripts.com/forum/thread162850.html</description><pubDate>Tue, 22 Jan 2008 02:53:03 GMT</pubDate><dc:creator>vyas</dc:creator></item><item><title>Removing trailing spaces in a table column</title><link>http://www.sqlservercentral.com/Forums/Topic445783-145-1.aspx</link><description>Hi I am having trouble removing trailing spaces in a table column (query phrase).so far i have tried using Ltrim , rtrim but no luck , i have used len and substring as well . funny thing is when using len(queryphrase) its counting the trailing space.also an update with replace dosen't work I have set the table with ansi padding off and have used both nvarchar and char columns to see if it made any difference , but no luck there either.Are there any other options available ???Thanks in advance:-)</description><pubDate>Tue, 22 Jan 2008 02:43:50 GMT</pubDate><dc:creator>Jayanth_Kurup</dc:creator></item></channel></rss>