Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 19th, 2004, 12:21 PM
seigo seigo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 11 seigo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 31 sec
Reputation Power: 0
Could not drop table because it is referenced by a foreign key conctraint

I try start replication, but give following error:

Could not drop table because it is referenced by a foreign key conctraint.

How I fixed this?

Reply With Quote
  #2  
Old October 21st, 2004, 01:53 AM
Leslie's Avatar
Leslie Leslie is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Honolulu
Posts: 184 Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 29 m 2 sec
Reputation Power: 8
when you start replication it is running a script of SQL Commands to drop and create tables. If the commands appear out of order from the referrential integrity of the database you will get that error. IT means that you are trying to drop a table when there is a related table that has data in it. Such as a CUSTOMER table might have a relationship with an INVOICES table in the form of a "foreign key" where the customerId in the INVOICES table is keyed to the "foreign" field CUSTOMER.CustomerID. In this case you CANNOT drop CUSTOMER table if ANY related records exist in INVOICES. If you can look at the SQL Script you can move around your commands to FIRST drop INVOICES and then drop CUSTOMERS.

SQL Server scripting never has been good at producing them in a working order. You have to manually review the order of the statements with regard to your specific database.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Could not drop table because it is referenced by a foreign key conctraint


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT