User Tools

Site Tools


microsoft:microsoft_sql_server:sql:find:find_leading_or_trailing_spaces

Microsoft - Microsoft SQL Server - SQL - Find - Find Leading or Trailing Spaces

Find Leading and Trailing spaces

SELECT * FROM #Temp 
WHERE name LIKE '% ' --Will provide us values with Trailing space/s
OR name LIKE ' %'     --Will provide us values with leading Space/s

Update the records and remove leading and trailing spaces

UPDATE #Temp
SET Name=LTRIM(RTRIM(Name))
WHERE name LIKE '% ' 
OR name LIKE ' %'
microsoft/microsoft_sql_server/sql/find/find_leading_or_trailing_spaces.txt · Last modified: 2021/08/05 14:38 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki