declare @s nvarchar(500)
declare c cursor for
select 'update ['+a.name+']'+ ' set ['+b.name+']=ltrim(rtrim(['+b.name+']))'
from sysobjects a
join syscolumns b
on a.id=b.id
and b.xtype in(167,175)
where a.xtype='U '
open c
fetch next from c into @s
while @@fetch_status=0
begin
exec(@s)
fetch next from c into @s
end
close c
deallocate c