Technical Article

Trim Function

,

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

Rate

1 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

1 (1)

You rated this post out of 5. Change rating