declare @name varchar(50),
@sql nvarchar(1000)
declare t_cursor cursor for
select
distinct a.name
from
sysobjects a,syscolumns b
where
a.id = b.id and b.name=N'globalCompanyCode'
open t_cursor
fetch next from t_cursor into @name
while @@fetch_status=0
begin
select @sql='update '+ @name +' set globalCompanyCode=''sample'''
exec(@sql)
fetch next from t_cursor into @name
end
close t_cursor
deallocate t_cursor