首页 > 数据库技术 > 详细

SQL常用语句

时间:2016-12-01 11:46:43      阅读:244      评论:0      收藏:0      [点我收藏+]
--查询表主键
EXEC sp_pkeys @table_name=Plat_CommAttrSelect

--删除表主键
Declare @Pk varChar(100);
Select @Pk=Name from sysobjects where Parent_Obj=OBJECT_ID(Plat_CommAttrSelect) and xtype=PK;
if @Pk is not null
exec(Alter table Plat_CommAttrSelect Drop + @Pk)

--添加表主键
alter table Plat_CommAttrSelect add constraint Plat_CommAttrSelect_PK primary key(ID)

 

SQL常用语句

原文:http://www.cnblogs.com/onesmail/p/6121094.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!