dbTalk Databases Forums  

Want to remove primary key

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Want to remove primary key in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mada suresh
 
Posts: n/a

Default Want to remove primary key - 03-28-2011 , 07:07 AM






Hi friends,
A pleasant greetings for one and all.I have the table
which name is ALA.It has a column id.i set id as primary key.Can any
one help me .please.

i tried this query but no use,,,

alter table ala drop primary key;

Reply With Quote
  #2  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Want to remove primary key - 03-28-2011 , 08:56 AM






mada suresh wrote:
Quote:
Hi friends,
A pleasant greetings for one and all.I have the table
which name is ALA.It has a column id.i set id as primary key.Can any
one help me .please.

i tried this query but no use,,,

alter table ala drop primary key;
ALTER TABLE dbo.ALA
DROP CONSTRAINT name_of_primary_key_constraint

If relationships/foreign keys referencing this column exist, you will likely
have to drop those as well.

Reply With Quote
  #3  
Old   
Henk van den Berg
 
Posts: n/a

Default Re: Want to remove primary key - 03-28-2011 , 11:29 AM



And to find out the name_of_primary_key_constraint you can use this:
SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE LOWER(TABLE_NAME) = 'ala' AND CONSTRAINT_TYPE = 'PRIMARY KEY'

Best,
Henk

On 28-03-2011 15:56, Bob Barrows wrote:
Quote:
mada suresh wrote:
Hi friends,
A pleasant greetings for one and all.I have the table
which name is ALA.It has a column id.i set id as primary key.Can any
one help me .please.

i tried this query but no use,,,

alter table ala drop primary key;

ALTER TABLE dbo.ALA
DROP CONSTRAINT name_of_primary_key_constraint

If relationships/foreign keys referencing this column exist, you will likely
have to drop those as well.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.