whats wrong with this query

  • 9 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.

    Regards,

    Royal

     

  • 9 years ago

    Royal,

    Did you try simply using:

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

    ?

     Joe
     

     

  • 9 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.

    Regards,

    Royal

  • 9 years ago

    No problemo Royal,

    Glad you got it sorted :)

    Joe 

     

Post a reply

Enter your message below

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

Contribute

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.

“In theory, theory and practice are the same. In practice, they're not.”