Do you know if there\'s a quick way in sql server (via transact-sql) that I could trim all the database string fields.
-- V Quick and Dirty !
-- If this is to generate code to run on a single table, run this code with text output ;
set nocount on
declare @table nvarchar(100) select @table = 'YourTableHere'
SELECT 'UPDATE ' + @table + ' SET ' SELECT '[' + Column_Name + '] = ' + 'LTRIM(RTRIM([' + Column_Name + '])), ' FROM INFORMATION_SCHEMA.Columns WHERE Table_Name = @table AND Data_Type LIKE '%CHAR%'
-- Run as text output (Query/Results To... Results To Text -- Copy and paste the text output (excluding the last comma) into a new query window, and run it .