LTRIM and RTRIM in SQL Server

TRIM function in SQL Server

TRIM function is used to removed the space of given strings.

Two types of TRIM function. i.e.

1.       RTRIM function
2.       LTRIM function

The RTRIM function is used to remove the right side space of given string.
The LTRIM function is used to remove the left side space of given string.

The query using  LTRIM and RTRIM as given below.

ALTER FUNCTION [dbo].[TRIM_STRING](@TEXT_STRING NVARCHAR(MAX))

RETURNS NVARCHAR(MAX)

BEGIN
     RETURN LTRIM(RTRIM(@TEXT_ STRING))
END




ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

www.code-sample.com/. Powered by Blogger.
^