For trim the spaces SQL Server has no function which can do trimming
from both end instead it has function LTRIM and RTRIM.
You can create your own
function and use it in your code or query whenever required. It will be termed
as UDF.
CREATE FUNCTION dbo.TRIM(@string VARCHAR(MAX))
RETURNS VARCHAR(MAX)
BEGIN
RETURN LTRIM(RTRIM(@string))
END
GO
This function will take input as string which need to be
trimmed.
No comments:
Post a Comment