whats wrong with this query

  • 12 years ago

    hi all,

    I was using the following sql query command to drop the relation(constraint), i used the following command to do this:

    ALTER TABLE [dbo].[tbEmpQualification] DROP CONSTRAINT [FK_tbEmpQualification_tbEmpInfo] FOREIGN KEY([fkEmpCd]) REFERENCES [dbo].[tbEmpInfo] ([pkEmpCd])

    But it gives me the following error:


    Msg 156, Level 15, State 1, Line 1

    Incorrect syntax near the keyword 'FOREIGN'.

    Can u guide me where I am going wrong.




  • 12 years ago


    Did you try simply using:

    ALTER TABLE [dbo].[tbEmpQualification] DROP CONSTRAINT [FK_tbEmpQualification_tbEmpInfo]




  • 12 years ago

    hi Joe,

    Nice to see u after a long gap. ya, I got it correct, did the same thing last week. I needed to delete the relation from the Database Diagram. So I directly did it throught the diagram.

    Anyways, thanks for your concern.



  • 12 years ago

    No problemo Royal,

    Glad you got it sorted :)



Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The question of whether computers can think is just like the question of whether submarines can swim.” - Edsger W. Dijkstra