I realize that RTrim(LTrim is not that hard to type, but, I feel this is cleaner
2007-10-02 (first published: 2002-06-20)
15,451 reads
I realize that RTrim(LTrim is not that hard to type, but, I feel this is cleaner
/* ******************************************************************************* Created by:Scott Williams When created:05/16/07 Purpose:Trim Function ******************************************************************************* ************************************************************************************************************ MODIFICATIONS DateInitialsChange Made ************************************************************************************************************ Example: SELECT dbo.Trim(' Trim Me ') @ThisString = The string to trim */ CREATE FUNCTION [dbo].[TRIM] (@ThisString varchar(4000)) RETURNS nvarchar(4000) AS BEGIN DECLARE @ReturnString VARCHAR(8000) SET @ReturnString = RTrim(LTrim(@ThisString)) RETURN @ReturnString END