How to Get Trim String in SQL Server

In SQL no any TRIM function, it content LTRIM and RTRIM. so i created user function it called TRIM(<string>) for us for get trim string.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE
 FUNCTION [dbo].[TRIM](@string VARCHAR(MAX))
RETURNS VARCHAR(MAX)
BEGIN
RETURN
 LTRIM(RTRIM(@string))
END

Ebook Download
View all
Learn
View all