Return to Snippet

Revision: 37541
at December 11, 2010 11:06 by emregulcan


Initial Code
CREATE FUNCTION dbo.Trim
(
   @string nvarchar(max)
)
RETURNS nvarchar(max)
AS
BEGIN
   RETURN LTRIM(RTRIM(@string))
END

Initial URL

                                

Initial Description
Today I need Trim() function in sql, but in Sql 2005 there is no function. Because of that I wrote this user (scalar) fuction.
It's very basic;
-First; it's Right Trim (RTrim()) string 
- And then Left Trim (LTrim())

Initial Title
SQL Trim Function

Initial Tags
sql

Initial Language
SQL