Link to home
Start Free TrialLog in
Avatar of venmarces
venmarcesFlag for Canada

asked on

Can not add a Foreign Key in a Table for a TimeOut Msg Error

Hi There

I would like to create a Feoreign Key into a Table T1 .. the Foreign Key is a Primary Key in another Table T2 .....

Whene I did this even with the MgmtStudio or via SQL Script I noticed that it took too much time and finished always with this Msg :


'T2' table saved successfully
'T1' table
- Unable to create relationship 'FK_tblManufacturingBP_tblBomType'.  
Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Could not create constraint. See previous errors.

What I find very strange is that T1 table is similar to another table called T3 and for which this FK was created correctly ..... Of Course, I changed names and so on .....

Any help with this

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Have you checked if there are any open transactions locking the table?

dbcc opentran

exec sp_who 50
-- Where the id is the SPID from DBCC OPENTRAN

exec sp_lock 50
-- Where the id is the SPID from DBCC OPENTRAN
Avatar of venmarces

ASKER

I tried the exec sp_Who and lock and nothing happening ....
working well