Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
my table have attributes stid primaykey
stname
phone


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

SQL
alter table student drop primary key(stid)
Posted
Updated 22-Apr-13 2:45am
v2
Comments
Sandeep Mewara 22-Apr-13 7:48am    
Elaborate more on what is your expected result and what are you looking it for?
vijay bisht 22-Apr-13 7:57am    
expane your problem ...... whar error r ru getting
gvprabu 22-Apr-13 8:46am    
hi...Read DDL Statements Syntax first.
Check the link.
http://msdn.microsoft.com/en-IN/library/ms190273.aspx

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.
 
Share this answer
 
ALTER TABLE STUDENT DROP PRIMARY KEY

(OR)

ALTER TABLE STUDENT DROP CONSTRAINT stid
 
Share this answer
 
SQL
ALTER TABLE student
DROP PRIMARY KEY
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900