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 '% ';
UPDATE YourTable
SET ColumnName = LTRIM(RTRIM(ColumnName))
WHERE ColumnName LIKE ' %' OR ColumnName LIKE '% ';