Forum Discussion

Martin_Sachers's avatar
Martin_Sachers
Copper Contributor
Aug 04, 2022

Error 3727

Hi there,

I try to delete a foreign key with

"

ALTER TABLE [dbo].[Projektplanung] DROP CONSTRAINT [Projektplanung$tblLookupCountriesProjektplanung]
GO

"

But I have to cancel it and get Err 3737 afterwoods as it doesn´t finish. This worked for months now as this is built into a script where I delete the constraint and build it again after importing data into the table.

 

As this command works with 50 more tables and I get this error on 3 tables since today I´m very confused.

  • olafhelper's avatar
    olafhelper
    Aug 04, 2022

    Martin_Sachers , next time please post the complete error message, not only the number.

    select *
    from sys.messages
    where message_id = 3727

    > Could not drop constraint. See previous errors.

    And what was the previous error?

     

    Olaf

  • Martin_Sachers's avatar
    Martin_Sachers
    Copper Contributor
    Supplement:
    As I found out there are 3 more constraints to the same table [tblLookupCountries] which cannot be deleted.
    • olafhelper's avatar
      olafhelper
      Bronze Contributor

      Martin_Sachers , next time please post the complete error message, not only the number.

      select *
      from sys.messages
      where message_id = 3727

      > Could not drop constraint. See previous errors.

      And what was the previous error?

       

      Olaf

      • Martin_Sachers's avatar
        Martin_Sachers
        Copper Contributor

        olafhelper There were no previous errors. It just did nothing visibly.

        The problem is solved: There are 4 foreign keys which connect to the table. I tried the whole story an hour later and it worked again. Conclusio: The table was locked. The problem is that it didn´t show at all.

         

        BR

        Martin

Resources