15,749,039 members
See more:
Hi All,

Would anyone please tell me how to drop a foreign key constraint defined on column level in sql(or we can say having no name).

Code Example:
SQL
```Create Table Employee
(
Employee_ID int Primary Key,
Job_ID int Foreign Key references JOB(Job_ID)
)```

/*consider there is another table Named "JOB" with column Job-ID*/
Posted
Updated 6-Jun-12 0:23am
v2

## Solution 2

You can't drop the column because it depends on another column, but you can remove the key from the column. object explorer->expand your table->keys->right click->delete

## Solution 3

hi,

CREATE TABLE [dbo].[t3](
[id] [int] NOT NULL,
[n_id] [int] NULL,
CONSTRAINT [PK_t3] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

CREATE TABLE [dbo].[t3](
[id] [int] NOT NULL,
[n_id] [int] NULL,
CONSTRAINT [PK_t3] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[t3] WITH CHECK ADD CONSTRAINT [FK_t3_t2] FOREIGN KEY([id])
REFERENCES [dbo].[t2] ([n_id])
GO

alter table drop constraint FK_t3_t2

## Solution 1

alter table Employee drop Employee_Job_ID