Community discussion forum

whats wrong with this query

  • 7 months 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

     

  • Advertisement

    Simply the fastest line-level profiler for .NET ever

    “The low overhead means it has minimal impact on the execution of my program”
    Mark Everest, Development Team Leader, Renault F1 Team Ltd.

    Try out the new ANTS Profiler 4 for yourself. Download your 14-day trial now

  • 6 months ago

    Royal,

    Did you try simply using:

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

    ?

     Joe
     

     

  • 6 months 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

  • 6 months 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).