关于查询的问题 [英] question about query

查看:62
本文介绍了关于查询的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的桌子有属性stid primaykey

stname

手机




$ b $我希望删除主键我写下面的查询但它无法工作



  alter  学生 drop   primary   key (stid)

解决方案





如果没有错误 SID 是您尝试使用 PRIMARY Key删除的列名关键字。所以,这是不可能的。您可能必须删除与表关联的主要内容,只需指定主键关键字,或指定主键约束名称。



参考文章 SQL SERVER如何删除主键约束 [ ^ ]以各种方式放弃约束。



希望它有所帮助。


ALTER TABLE STUDENT DROP PRIMARY KEY



(OR)



ALTER TABLE STUDENT DROP CONSTRAINT stid


< pre lang =sql> ALTER TABLE student
DROP PRIMARY KEY


my table have attributes stid primaykey
stname
phone


i want to drop primary key i write below query but it can not work

alter table student drop primary key(stid)

解决方案

Hi,

if am not wrong "SID" is your column name which you are trying to delete by using PRIMARY Key keyword. so, that is not possible. you may have to drop the primary associated with table just specifying the primary key keyword, or specifying the primary key constraint name.

refer the article SQL SERVER How to Drop Primary Key Contraint[^] for various ways of droping the constraints.

hope it helps.


ALTER TABLE STUDENT DROP PRIMARY KEY

(OR)

ALTER TABLE STUDENT DROP CONSTRAINT stid


ALTER TABLE student
DROP PRIMARY KEY


这篇关于关于查询的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆