SOLVED

Error 3727

Copper Contributor

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.

4 Replies
Supplement:
As I found out there are 3 more constraints to the same table [tblLookupCountries] which cannot be deleted.
best response confirmed by Martin_Sachers (Copper Contributor)
Solution

@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

@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

Hi @Martin_Sachers

For the sake of the next time.


> There were no previous errors.

 

You can get the previous error and all the information which come in the errors from the SQL Server error log file, as explain the this doc.

 

Conclusio: The table was locked. The problem is that it didn´t show at all.

 

Next time you can check locks using sp_lock or sys.dm_tran_locks.

I am not sure that your conclusion are correct without more info

 

The problem is solved

 

Glad to hear :) have a great day

1 best response

Accepted Solutions
best response confirmed by Martin_Sachers (Copper Contributor)
Solution

@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

View solution in original post