Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8846161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:54:41+00:00 2026-06-14T11:54:41+00:00

I’m designing a database schema, and I’m stuck on one part. Below is a

  • 0

I’m designing a database schema, and I’m stuck on one part. Below is a simplified version of my schema. Could someone please explain why the following SQL:

CREATE TABLE Users (
  UserID INT NOT NULL PRIMARY KEY,
  FName VARCHAR(64) NOT NULL,
  LName VARCHAR(64) NOT NULL,
  UName VARCHAR(64) NOT NULL UNIQUE,
  PWord CHAR(32) NOT NULL,
  Role VARCHAR(13) NOT NULL
);

...

CREATE TABLE Sale (
  SaleID INT NOT NULL PRIMARY KEY,
  Book INT NOT NULL REFERENCES Books(BookID) ON DELETE NO ACTION,
  Merchant INT NOT NULL REFERENCES Users(UserID) ON DELETE CASCADE,
  Upload DATETIME NOT NULL,
  Sold BIT NOT NULL,
  Price DECIMAL(10, 2) NOT NULL,
  Condition VARCHAR(9) NOT NULL,
  Written BIT NOT NULL,
  Comments VARCHAR(8000) NULL
);

...

CREATE TABLE Purchases (
  PurchaseID INT NOT NULL PRIMARY KEY,
  Buyer INT NOT NULL REFERENCES Users(UserID) ON DELETE CASCADE,
  Merchant INT NOT NULL REFERENCES Users(UserID) ON DELETE NO ACTION,
  Sale INT NOT NULL REFERENCES Sale(SaleID) ON DELETE CASCADE UNIQUE,
  Time DATETIME NOT NULL
);

… results in this error, and how I can overcome it:

Msg 1785, Level 16, State 0, Line 38
Introducing FOREIGN KEY constraint 'FK__Purchases__Sale__25869641' on table
'Purchases' may cause cycles or multiple cascade paths. Specify ON DELETE
NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.

I would like to keep the ON DELETE CASCADE for the Purchases.Sale attribute, if possible.

Thank you for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:54:42+00:00Added an answer on June 14, 2026 at 11:54 am

    Most likely it’s because you reference “Users” from two different tables – Buyer in Purchases and Merchant in Sale. The database probably doesn’t realize that these two records are never the same – but it knows that it’s the same table and therefore complains about a potential issue with cascading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I'm outputting a post title and in our database, it's Hello Y’all
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
Does anyone know how can I replace this 2 symbol below from the string
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a reasonable size flat file database of text documents mostly saved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.