| Author |
Topic  |
|
|
fabianus76
Posting Yak Master
191 Posts |
Posted - 06/23/2006 : 19:39:53
|
Hello !
I try to drop a table, but I get this message :
Could not drop object 'dbo.cs_Users' because it is referenced by a FOREIGN KEY constraint
This message does not tell me which is the Foreign key constraint so that I may disable it.
Any solution to force the dropping?
Thank you very much!
Regards, Fabian
my favorit hoster is ASPnix : www.aspnix.com ! |
|
|
khtan
In (Som, Ni, Yak)
Singapore
16746 Posts |
Posted - 06/23/2006 : 19:54:19
|
you will have to drop the foreign key constraint first.
use sp_help table_name to see the constraint
KH
|
 |
|
|
fabianus76
Posting Yak Master
191 Posts |
Posted - 06/23/2006 : 20:03:30
|
Hello khtan,
thank you for your reply.
Is there no more simple way to go? I mean like this I have to delete all foreign key constraints first, and then manually recrate them? Isn't there a command that holds on for a moment the constraints?
Regards, Fabian
my favorit hoster is ASPnix : www.aspnix.com ! |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
USA
4184 Posts |
Posted - 06/23/2006 : 21:29:52
|
There is not a command that will let you drop tables without removing the constraints. You can use the object explorer in Query Analyzer to see and easily script out drop/create for the constraints though. You can also script the object using the wizard in Enterprise Manager. It will script out all the primary keys, foreign keys, constraints, etc for the object.
MeanOldDBA derrickleggett@hotmail.com
When life gives you a lemon, fire the DBA. |
 |
|
| |
Topic  |
|