Skip to content
  • There are no suggestions because the search field is empty.

T SQL Script: Trim All Leading or Trailing Spaces for Column Names in a Table

T SQL Script: Trim All Leading or Trailing Spaces for Column Names in a Table

-- Trim All Leading or Trailing Spaces for Column Names in a Table
UPDATE YourTable
SET ColumnName = LTRIM(RTRIM(ColumnName))
WHERE ColumnName LIKE ' %' OR ColumnName LIKE '% ';