Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Could not drop table!
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

191 Posts

Posted - 06/23/2006 :  19:39:53  Show Profile  Reply with Quote
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!


my favorit hoster is ASPnix : !

In (Som, Ni, Yak)

17689 Posts

Posted - 06/23/2006 :  19:54:19  Show Profile  Reply with Quote
you will have to drop the foreign key constraint first.

use sp_help table_name to see the constraint


Go to Top of Page

Posting Yak Master

191 Posts

Posted - 06/23/2006 :  20:03:30  Show Profile  Reply with Quote
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?


my favorit hoster is ASPnix : !
Go to Top of Page

Pointy Haired Yak DBA

4184 Posts

Posted - 06/23/2006 :  21:29:52  Show Profile  Visit derrickleggett's Homepage  Send derrickleggett an AOL message  Send derrickleggett a Yahoo! Message  Reply with Quote
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.


When life gives you a lemon, fire the DBA.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000