<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; 2008 &#8211; TRIM() Function &#8211; User Defined Function</title>
	<atom:link href="http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/</link>
	<description>SQL, SQL Server, MySQL, Big Data and NoSQL</description>
	<lastBuildDate>Wed, 19 Jun 2013 21:45:15 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Romi</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-467961</link>
		<dc:creator><![CDATA[Romi]]></dc:creator>
		<pubDate>Thu, 02 May 2013 20:48:22 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-467961</guid>
		<description><![CDATA[ALTER FUNCTION dbo.TRIM(@string VARCHAR(MAX))
RETURNS VARCHAR(MAX)
BEGIN
	While CharIndex(&#039;  &#039;,@string) &gt; 0
	Begin
		SELECT @string = LTRIM(RTRIM(REPLACE(@string, &#039;  &#039;, &#039; &#039;)))
		exec dbo.trim @string
	End
	
	RETURN @string
END
GO]]></description>
		<content:encoded><![CDATA[<p>ALTER FUNCTION dbo.TRIM(@string VARCHAR(MAX))<br />
RETURNS VARCHAR(MAX)<br />
BEGIN<br />
	While CharIndex(&#8216;  &#8216;,@string) &gt; 0<br />
	Begin<br />
		SELECT @string = LTRIM(RTRIM(REPLACE(@string, &#8216;  &#8216;, &#8216; &#8216;)))<br />
		exec dbo.trim @string<br />
	End</p>
<p>	RETURN @string<br />
END<br />
GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seyha</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-453023</link>
		<dc:creator><![CDATA[Seyha]]></dc:creator>
		<pubDate>Wed, 10 Apr 2013 08:47:48 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-453023</guid>
		<description><![CDATA[I got the String &quot;Pring Kea&quot; in my Database, that it&#039;s not show the space or character code infront of that string.
So when copy and paste in OpenOffice, its display like this &quot;##Pring Kea&quot;.
But when i copy into Excel, it&#039;s display like this &quot;_x001F__x001F_Pring Kea&quot;.

So i want to Remove or Trim the string that is hidden infront of &quot;Pring Kea&quot;.
Do you have any solution for this...?

Thank...]]></description>
		<content:encoded><![CDATA[<p>I got the String &#8220;Pring Kea&#8221; in my Database, that it&#8217;s not show the space or character code infront of that string.<br />
So when copy and paste in OpenOffice, its display like this &#8220;##Pring Kea&#8221;.<br />
But when i copy into Excel, it&#8217;s display like this &#8220;_x001F__x001F_Pring Kea&#8221;.</p>
<p>So i want to Remove or Trim the string that is hidden infront of &#8220;Pring Kea&#8221;.<br />
Do you have any solution for this&#8230;?</p>
<p>Thank&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; TRIM Function to Remove Leading and Trailing Spaces of String &#8211; SQL in Sixty Seconds #040 &#8211; Video &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-411521</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; TRIM Function to Remove Leading and Trailing Spaces of String &#8211; SQL in Sixty Seconds #040 &#8211; Video &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Wed, 23 Jan 2013 01:30:40 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-411521</guid>
		<description><![CDATA[[...] TRIM() Function – User Defined Function [...]]]></description>
		<content:encoded><![CDATA[<p>[...] TRIM() Function – User Defined Function [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-336063</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Thu, 23 Aug 2012 06:25:36 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-336063</guid>
		<description><![CDATA[Not the same output. You can see it from the following example


SELECT &#039;a&#039;+RTRIM(LTRIM(&#039; Word &#039;))+&#039;a&#039; AS Answer
SELECT &#039;a&#039;+((&#039; Word &#039;))+&#039;a&#039; AS Answer]]></description>
		<content:encoded><![CDATA[<p>Not the same output. You can see it from the following example</p>
<p>SELECT &#8216;a&#8217;+RTRIM(LTRIM(&#8216; Word &#8216;))+&#8217;a&#8217; AS Answer<br />
SELECT &#8216;a&#8217;+((&#8216; Word &#8216;))+&#8217;a&#8217; AS Answer</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeni</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-335598</link>
		<dc:creator><![CDATA[Jeni]]></dc:creator>
		<pubDate>Wed, 22 Aug 2012 14:12:31 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-335598</guid>
		<description><![CDATA[Hi,

just now am learning about the SQL server, I cant understand exactly. I ned more explanation. i did with this example : 
 SELECT RTRIM(LTRIM(&#039;   Word  &#039;)) AS Answer

Output : word 

 But without giving the keywords also same output is generating, wats the difference.
SELECT ((&#039;   Word  &#039;)) AS Answer

Output : word   - Same output]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>just now am learning about the SQL server, I cant understand exactly. I ned more explanation. i did with this example :<br />
 SELECT RTRIM(LTRIM(&#8216;   Word  &#8216;)) AS Answer</p>
<p>Output : word </p>
<p> But without giving the keywords also same output is generating, wats the difference.<br />
SELECT ((&#8216;   Word  &#8216;)) AS Answer</p>
<p>Output : word   &#8211; Same output</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sahhnawaz</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-260730</link>
		<dc:creator><![CDATA[Sahhnawaz]]></dc:creator>
		<pubDate>Thu, 08 Mar 2012 08:32:10 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-260730</guid>
		<description><![CDATA[This function returns string after removing filter.
for exampe - i passed select [Func_FilterDelimted](&#039;aa,bb,cc,dd,ee&#039;)
outpur - aabbccddee
====
ALTER FUNCTION [dbo].[Func_FilterDelimted] 
(
	-- Add the parameters for the function here
	@Deli_Str nvarchar(max)
)
RETURNS nvarchar(max)
AS
BEGIN
	-- Declare the return variable here
	
	Declare @Lng smallint=0;
	Declare @St nvarchar(max)=&#039;&#039;;
	Declare @comm nvarchar(1)=&#039;&#039;;
	Declare @i smallint=0;
	Declare @Asc smallint=0;
	Set @Lng=Len(@Deli_Str);
	
	Begin
	set @i=0;
		While @i&lt;=@Lng
		Begin
			Set @comm=substring(@Deli_Str,@i,1);
			Set @Asc=Ascii(@comm);
			If(@Asc!=44)
			Begin
				Set @St=@St+@comm;
			End;
			--Else
			--Begin
			--	Insert into #FilterTable(ServiceID)Values(Cast(@St as int));
			--End;
			
			Set @i=@i+1;
		End;
	End;
	
	-- Return the result of the function
	RETURN @St

END]]></description>
		<content:encoded><![CDATA[<p>This function returns string after removing filter.<br />
for exampe &#8211; i passed select [Func_FilterDelimted](&#8216;aa,bb,cc,dd,ee&#8217;)<br />
outpur &#8211; aabbccddee<br />
====<br />
ALTER FUNCTION [dbo].[Func_FilterDelimted]<br />
(<br />
	&#8211; Add the parameters for the function here<br />
	@Deli_Str nvarchar(max)<br />
)<br />
RETURNS nvarchar(max)<br />
AS<br />
BEGIN<br />
	&#8211; Declare the return variable here</p>
<p>	Declare @Lng smallint=0;<br />
	Declare @St nvarchar(max)=&#8221;;<br />
	Declare @comm nvarchar(1)=&#8221;;<br />
	Declare @i smallint=0;<br />
	Declare @Asc smallint=0;<br />
	Set @Lng=Len(@Deli_Str);</p>
<p>	Begin<br />
	set @i=0;<br />
		While @i&lt;=@Lng<br />
		Begin<br />
			Set @comm=substring(@Deli_Str,@i,1);<br />
			Set @Asc=Ascii(@comm);<br />
			If(@Asc!=44)<br />
			Begin<br />
				Set @St=@St+@comm;<br />
			End;<br />
			&#8211;Else<br />
			&#8211;Begin<br />
			&#8211;	Insert into #FilterTable(ServiceID)Values(Cast(@St as int));<br />
			&#8211;End;</p>
<p>			Set @i=@i+1;<br />
		End;<br />
	End;</p>
<p>	&#8211; Return the result of the function<br />
	RETURN @St</p>
<p>END</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Lee</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-204818</link>
		<dc:creator><![CDATA[Richard Lee]]></dc:creator>
		<pubDate>Sat, 26 Nov 2011 07:31:31 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-204818</guid>
		<description><![CDATA[No this is fundamentally incorrect. Even the verb &quot;to trim&quot; means to cut off the bit around the edge (like a haircut trim - doesn&#039;t mean to shave off all the hair!). Trim in every language (and other RDBMS I&#039;ve used - and I&#039;ve used a lot) means to cut of white space at eaither end, NOT to remoave all white space. There is already a function to do the latter: Remove (or Replace language/RDBMS dependant). LTRIM(RTIM(&#039; string &#039;)) is the right way to go, and has little overhead above &#039;Trim&#039; as both require a by-char scan until first non-blank is reached (Rtirm obviously runs backwards from the end).]]></description>
		<content:encoded><![CDATA[<p>No this is fundamentally incorrect. Even the verb &#8220;to trim&#8221; means to cut off the bit around the edge (like a haircut trim &#8211; doesn&#8217;t mean to shave off all the hair!). Trim in every language (and other RDBMS I&#8217;ve used &#8211; and I&#8217;ve used a lot) means to cut of white space at eaither end, NOT to remoave all white space. There is already a function to do the latter: Remove (or Replace language/RDBMS dependant). LTRIM(RTIM(&#8216; string &#8216;)) is the right way to go, and has little overhead above &#8216;Trim&#8217; as both require a by-char scan until first non-blank is reached (Rtirm obviously runs backwards from the end).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-180744</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 19 Oct 2011 09:45:57 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-180744</guid>
		<description><![CDATA[Yes it will work for nvarchar too. What di you mean by it is not working?]]></description>
		<content:encoded><![CDATA[<p>Yes it will work for nvarchar too. What di you mean by it is not working?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vaibes</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-180403</link>
		<dc:creator><![CDATA[Vaibes]]></dc:creator>
		<pubDate>Tue, 18 Oct 2011 17:21:49 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-180403</guid>
		<description><![CDATA[is it applicable for nvarchar ????
I tried for a column but its not working
query used: select LTRIM(RTRIM(Col1)) from [TABLE] order by Col1]]></description>
		<content:encoded><![CDATA[<p>is it applicable for nvarchar ????<br />
I tried for a column but its not working<br />
query used: select LTRIM(RTRIM(Col1)) from [TABLE] order by Col1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andres Tenllo</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-167792</link>
		<dc:creator><![CDATA[Andres Tenllo]]></dc:creator>
		<pubDate>Tue, 13 Sep 2011 16:06:40 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-167792</guid>
		<description><![CDATA[Hi there, I&#039;m not sure about this trim functionality on sql 2005/2008 is the same structure ? if I create this function on sql 2005 works on 2008 ? I really appreciate if someone could answer to me.]]></description>
		<content:encoded><![CDATA[<p>Hi there, I&#8217;m not sure about this trim functionality on sql 2005/2008 is the same structure ? if I create this function on sql 2005 works on 2008 ? I really appreciate if someone could answer to me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KKMR</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-163903</link>
		<dc:creator><![CDATA[KKMR]]></dc:creator>
		<pubDate>Wed, 31 Aug 2011 09:00:39 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-163903</guid>
		<description><![CDATA[Hi blog.sqlauthority.com,

        what&#039;s the return type when function returns nothing.]]></description>
		<content:encoded><![CDATA[<p>Hi blog.sqlauthority.com,</p>
<p>        what&#8217;s the return type when function returns nothing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: khoshroo</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-158191</link>
		<dc:creator><![CDATA[khoshroo]]></dc:creator>
		<pubDate>Wed, 17 Aug 2011 06:45:54 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-158191</guid>
		<description><![CDATA[hi my friend
the answer is so simple 
TRIM FUNCTION
..
..
..
return replace(@S,&#039; &#039;,&#039;&#039;)]]></description>
		<content:encoded><![CDATA[<p>hi my friend<br />
the answer is so simple<br />
TRIM FUNCTION<br />
..<br />
..<br />
..<br />
return replace(@S,&#8217; &#8216;,&#8221;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Naresh</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-64132</link>
		<dc:creator><![CDATA[Naresh]]></dc:creator>
		<pubDate>Wed, 31 Mar 2010 12:10:05 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-64132</guid>
		<description><![CDATA[Hi Pinal,

Did SQL 2008 eliminates the empty space in the right side by default? Coz while executing the below queries, i have got the same result

Select Len(&#039; trail test&#039;)
Select Len(&#039; trail test    &#039;)]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Did SQL 2008 eliminates the empty space in the right side by default? Coz while executing the below queries, i have got the same result</p>
<p>Select Len(&#8216; trail test&#8217;)<br />
Select Len(&#8216; trail test    &#8216;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Altin</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-61084</link>
		<dc:creator><![CDATA[Altin]]></dc:creator>
		<pubDate>Fri, 12 Feb 2010 17:04:19 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-61084</guid>
		<description><![CDATA[trim() function should remove any space  and not only those on left or on right of the string. this is not trim().]]></description>
		<content:encoded><![CDATA[<p>trim() function should remove any space  and not only those on left or on right of the string. this is not trim().</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – Connect Item – Vote for Feature Request Function TRIM Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-52668</link>
		<dc:creator><![CDATA[SQL SERVER – Connect Item – Vote for Feature Request Function TRIM Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Wed, 03 Jun 2009 01:31:53 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-52668</guid>
		<description><![CDATA[[...] SQL SERVER – 2008 – TRIM() Function – User Defined Function [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER – 2008 – TRIM() Function – User Defined Function [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ranjani</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-44095</link>
		<dc:creator><![CDATA[Ranjani]]></dc:creator>
		<pubDate>Fri, 07 Nov 2008 07:10:01 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-44095</guid>
		<description><![CDATA[Actually I tried this query


SELECT RTRIM(&#039;       Hai       &#039;)


the result was like what i have given.
After that i gave alias name and then correct result come.
I want to know  that this query must have alias name?]]></description>
		<content:encoded><![CDATA[<p>Actually I tried this query</p>
<p>SELECT RTRIM(&#8216;       Hai       &#8216;)</p>
<p>the result was like what i have given.<br />
After that i gave alias name and then correct result come.<br />
I want to know  that this query must have alias name?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - 2008 - Enhenced TRIM() Function - Remove Trailing Spaces, Leading Spaces, White Space, Tabs, Carriage Returns, Line Feeds Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-43629</link>
		<dc:creator><![CDATA[SQL SERVER - 2008 - Enhenced TRIM() Function - Remove Trailing Spaces, Leading Spaces, White Space, Tabs, Carriage Returns, Line Feeds Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Fri, 10 Oct 2008 01:31:34 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-43629</guid>
		<description><![CDATA[[...] 10, 2008 by pinaldave    After reading my article SQL SERVER - 2008 - TRIM() Function - User Defined Function, I have received email and comments where user are asking if it is possible to remove trailing [...]]]></description>
		<content:encoded><![CDATA[<p>[...] 10, 2008 by pinaldave    After reading my article SQL SERVER &#8211; 2008 &#8211; TRIM() Function &#8211; User Defined Function, I have received email and comments where user are asking if it is possible to remove trailing [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jerry Hung</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-43623</link>
		<dc:creator><![CDATA[Jerry Hung]]></dc:creator>
		<pubDate>Thu, 09 Oct 2008 15:30:59 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-43623</guid>
		<description><![CDATA[If Microsoft will one day understand how to implement BASIC BASIC functions like TRIM, that alone will be worth a new SQL Server release :P

Speaking of which, are there cases where people actually only need LTRIM or RTRIM, and not TRIM?]]></description>
		<content:encoded><![CDATA[<p>If Microsoft will one day understand how to implement BASIC BASIC functions like TRIM, that alone will be worth a new SQL Server release :P</p>
<p>Speaking of which, are there cases where people actually only need LTRIM or RTRIM, and not TRIM?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kamran Shahid</title>
		<link>http://blog.sqlauthority.com/2008/10/09/sql-server-2008-trim-function-user-defined-function/#comment-43620</link>
		<dc:creator><![CDATA[Kamran Shahid]]></dc:creator>
		<pubDate>Thu, 09 Oct 2008 11:01:31 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1342#comment-43620</guid>
		<description><![CDATA[It will be the Great Feature whiich is planned to be included in SQl Server 2010 or + 
Micr0$0ft

:)]]></description>
		<content:encoded><![CDATA[<p>It will be the Great Feature whiich is planned to be included in SQl Server 2010 or +<br />
Micr0$0ft</p>
<p>:)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
