DECLARE @tablename VARCHAR(100)
DECLARE @fieldname VARCHAR(100)
DECLARE @sql VARCHAR(250)
DECLARE cur cursor
FOR
select sysobjects.name as tablename,syscolumns.name as fieldname
from syscolumns
left join sysobjects on syscolumns.id=sysobjects.id
where syscolumns.xtype='61' and sysobjects.xtype='U'
OPEN cur
FETCH NEXT FROM cur
INTO @tablename,@fieldname
WHILE @@FETCH_STATUS = 0
begin
SET @sql= 'UPDATE ' + @tablename+' SET '+@fieldname+' = '+@fieldname+'+1'
EXEC (@sql)
FETCH NEXT FROM cur
INTO @tablename,@fieldname
end
CLOSE cur
DEALLOCATE cur