Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


A question about Constraints


A question about Constraints

Author
Message
meichner
meichner
Old Hand
Old Hand (319 reputation)Old Hand (319 reputation)Old Hand (319 reputation)Old Hand (319 reputation)Old Hand (319 reputation)Old Hand (319 reputation)Old Hand (319 reputation)Old Hand (319 reputation)

Group: General Forum Members
Points: 319 Visits: 640
Given the following 3 tables:

Sales Order - Primary Key SOID
Sales Order Detail - Primary Key SOID and Line #
Shipping Details - Primary Key SOID and Line #

I put a contraint on the Sales Order Detail to make sure the SOID is in the Sales Order Table.

I put a constraint on the Shipping Details to make sure that the SOID and the Line # exist in the Sales Order Detail.

Is it a good or a bad idea to add another constraint to the Shipping Details table to make sure that the SOID exists in the Sales Order Table? It seems redundant to me but I don't have enough experience to know if I am correct or not.

Thanks
Lynn Pettis
Lynn Pettis
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26674 Visits: 38138
meichner (6/1/2009)

I put a constraint on the Shipping Details to make sure that the SOID and the Line # exist in the Sales Order Detail.

... It seems redundant to me ...

Thanks


I think you have answered your question right here.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
meichner
meichner
Old Hand
Old Hand (319 reputation)Old Hand (319 reputation)Old Hand (319 reputation)Old Hand (319 reputation)Old Hand (319 reputation)Old Hand (319 reputation)Old Hand (319 reputation)Old Hand (319 reputation)

Group: General Forum Members
Points: 319 Visits: 640
Lynn Pettis (6/1/2009)
meichner (6/1/2009)

I put a constraint on the Shipping Details to make sure that the SOID and the Line # exist in the Sales Order Detail.

... It seems redundant to me ...

Thanks


I think you have answered your question right here.


Thanks for the fast response. As I said, I don't have enough experience to know if I was correct or not.

Thanks again
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search