SQLServer在多个表中都增加一个字段的方法

declare @sql varchar(200), @name varchar(40) declare my_cursor scroll cursor for select name from sysobjects where type = \'u\' and name like \'jobs_%\' open my_cursor fetch next from my_cursor into @name while(@@fetch_status=0) begin print \'processing \' + @name set @sql = N\'alter table testbfcmisuser.\' + @name + N\' add note varchar(200)\' exec(@sql) print \'finished\' fetch next from my_cursor into @name end close my_cursor deallocate my_cursor

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzzjxw.html