views:

78

answers:

3

How to remove primary key constraint from column.

I have table t_data_dnefrc table. In that i have AccountNbr column which is primary key. I want to remove Primary key constraint for that column.

A: 

Note: this is mysql way - check Marcus's answer for the correct answer to OP's question.

ALTER TABLE t_data_dnefrc DROP PRIMARY KEY;
Amarghosh
I am getting error like incorrect syntax near 'PRIMARY'
pbrp
This is MySQL syntax
Marcus
oops - Thanks for that. Added a note to my post and +1ed you.
Amarghosh
+1  A: 

You need to drop the constraint, the name of which can be found in the Keys folder of the table in SQL Management Studio.

ALTER TABLE t_data_dnefrc
DROP CONSTRAINT constraintName;
Marcus
what is constraintname?
pbrp
"...the name of which can be found in the Keys folder of the table in SQL Management Studio". Expand the table, then expand the Keys folder. It's the yellow one...
Marcus
i did nt find any name. Its Key sysmbol in yellow.
pbrp
Did you refresh the list of keys?
Mark Canlas
i got it thanks.
pbrp
A: 

YOu realize that dropping a primary key is usually a bad idea, right?

HLGEM