Home All Groups Group Topic Archive Search About
Author
9 Sep 2006 9:44 AM
velmurugan(Internal)
HI FRENS,
                I WANT TO DROP PRIMARY KEY CONSTRAINT FROM A TABLE  USING
ALTER TABLE,PLEASE GIVE ME THE SYNYAX TO
DO SO.
VELMURUGAN.D

Author
9 Sep 2006 10:49 AM
David Portas
velmurugan(Internal) wrote:
> HI FRENS,
>                 I WANT TO DROP PRIMARY KEY CONSTRAINT FROM A TABLE  USING
> ALTER TABLE,PLEASE GIVE ME THE SYNYAX TO
> DO SO.
> VELMURUGAN.D


ALTER TABLE tbl DROP CONSTRAINT constraint_name ;

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
Author
9 Sep 2006 10:59 AM
Martin Poon [MVP]
ALTER TABLE MyTableName DROP CONSTRAINT MyPrimaryKeyName

- ALTER TABLE (Transact-SQL)
http://msdn2.microsoft.com/en-us/library/ms190273.aspx

--
Martin Poon
Microsoft MVP - SQL Server
--------------------------------------------------
- SQL Server 2005 books online
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
- SQL Server 2000 books online
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
==================================================
Show quote
"velmurugan(Internal)" <velmuru***@chellasoft.com> ¦b¶l¥ó
news:%23riCMT$0GHA.3908@TK2MSFTNGP05.phx.gbl ¤¤¼¶¼g...
> HI FRENS,
>                 I WANT TO DROP PRIMARY KEY CONSTRAINT FROM A TABLE  USING
> ALTER TABLE,PLEASE GIVE ME THE SYNYAX TO
> DO SO.
> VELMURUGAN.D
>
>
Author
9 Sep 2006 2:37 PM
Hari Prasad
Hi,

Get the Primary key constraint name using:-

sp_pkeys <Table_name>

Based on the PK_Name column in output execute

ALTER TABLE <Table_Name> Drop constraint <Constraint_name>

Thanks
Hari
SQL Server MVP

Show quote
"velmurugan(Internal)" <velmuru***@chellasoft.com> wrote in message
news:%23riCMT$0GHA.3908@TK2MSFTNGP05.phx.gbl...
> HI FRENS,
>                I WANT TO DROP PRIMARY KEY CONSTRAINT FROM A TABLE  USING
> ALTER TABLE,PLEASE GIVE ME THE SYNYAX TO
> DO SO.
> VELMURUGAN.D
>

AddThis Social Bookmark Button