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
How to Get Trim String in SQL Server
Here, I created user function it called TRIM for us for get trim string.

Join the conversation! Your thoughts help the community grow.