Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Help me in droping Foreign key

Author  Topic 

ganeshkumar08
Posting Yak Master

187 Posts

Posted - 2008-09-27 : 04:59:09
Hi All,

Can any one help me in droping foreign key from a table.
I used this syntax
ALTER TABLE dbo.TrendMATCHES
DROP FOREIGN KEY TrendCUP_ROUND_TrendMATCHES_FK1
I am getting error as below
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'FOREIGN'.

I need only query to delete the Foreign Key
Thanks
Ganesh Kumar


Solutions are easy. Understanding the problem, now, that's the hard part

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-09-27 : 05:13:04
try,
ALTER TABLE dbo.TrendMATCHES
DROP CONSTRAINT TrendCUP_ROUND_TrendMATCHES_FK1
Go to Top of Page

ganeshkumar08
Posting Yak Master

187 Posts

Posted - 2008-09-27 : 05:15:20
Thanks for u r response sunil.. it worked perfectly...

Solutions are easy. Understanding the problem, now, that's the hard part
Go to Top of Page
   

- Advertisement -