陈谊菡,47399小游戏,佛曰加密
declare @pk varchar(100);
declare @tbname varchar(100);
declare cursor1 cursor for
select sys2.name as tbname,sys1.name as pk from sysobjects sys1 join sysobjects sys2 on sys1.parent_obj = sys2.[id] where sys1.xtype='pk';
open cursor1
fetch next from cursor1 into @tbname,@pk
while @@fetch_status=0
begin
--exec('alter table '+@tbname+' drop '+ @pk) --删除原主键
--print 'alter table '+@tbname+' drop '+ @pk --打印
fetch next from cursor1 into @tbname,@pk
end
close cursor1 ;
deallocate cursor1;
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
SQL Server免费版的安装以及使用SQL Server Management Studio(SSMS)连接数据库的图文方法
SQL Server 2017 Developer的下载、安装、配置及SSMS的下载安装配置(图文教程详解)
网友评论