Loading lesson path
Concept visual
Start at both ends
Remove leading and trailing spaces from a string:
SELECT TRIM(' SQL Tutorial! ') AS TrimmedString;The TRIM() function removes the space character OR other specified characters from the start or end of a string. By default, the TRIM() function removes leading and trailing spaces from a string.
and
functions.
TRIM([ characters
] string )
Optional. Specific characters to remove string Required. The string to remove spaces or characters from
SQL Server (starting with 2017), Azure SQL Database,
Remove characters and spaces from a string:
SELECT TRIM('#! ' FROM ' #SQL Tutorial! ') AS
TrimmedString;❮ SQL Server Functions