0

my table structure is as given below

create table qwe
(
id int primary key,
employee varchar(100)
)

How to delete Primary key from the ID column . I have tried the following :

alter table qwe
alter column id int

I know I can remove this key by going into design mode, but is there a way to delete using SQL statement.

sam
  • 1,153
  • 3
  • 10
  • 28

2 Answers2

1

Try this

ALTER TABLE qwe
DROP CONSTRAINT id

Drop primary key using script in SQL Server database

check this link http://www.w3schools.com/sql/sql_primarykey.asp

http://blog.sqlauthority.com/2009/05/12/sql-server-how-to-drop-primary-key-contraint/

Community
  • 1
  • 1
Ajay
  • 6,396
  • 17
  • 68
  • 126
0

Try this:

ALTER TABLE qwe DROP CONSTRAINT id;

In case this gives an error, try:

ALTER TABLE qwe NOCHECK CONSTRAINT id;
shauryachats
  • 9,275
  • 4
  • 34
  • 47