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


Schema without FK relationship, is it OK


Schema without FK relationship, is it OK

Author
Message
mario17
mario17
SSC Veteran
SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)

Group: General Forum Members
Points: 254 Visits: 683
Hi, ALL

I Just checking a newly deisgned db at my new place, AND see there is NO FK contraints EXISTS FOR many tables, so
you can enter:

INSERT INTO tProdValues (Value, CategoryID) rows with any CategoryID (eg. = 99), even
they don't exist in tCategoryTypes, is this OK?

I thought that it alwayse shoud be SOME checking..

Thanks
Mario
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16523 Visits: 16991
mario17 (4/18/2014)
Hi, ALL

I Just checking a newly deisgned db at my new place, AND see there is NO FK contraints EXISTS FOR many tables, so
you can enter:

INSERT INTO tProdValues (Value, CategoryID) rows with any CategoryID (eg. = 99), even
they don't exist in tCategoryTypes, is this OK?

I thought that it alwayse shoud be SOME checking..

Thanks
Mario


It is impossible to say if it is ok or not from the extremely vague information posted. I can say that it sounds like referential integrity (RI) is a bit lax in that system. Assuming you have a table for CategoryTypes it is generally best to make a foreign key reference to that when using that type in another table. It doesn't make it "wrong" but it certainly raises some red flags.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Grant Fritchey
Grant Fritchey
SSCoach
SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)

Group: General Forum Members
Points: 17529 Visits: 32252
In general, I would consider this a very dangerous position. You may have dirty data in your systems and you won't know it.

Now, you may be in one of those situations where the "application is handling it all." Good luck! It almost never succeeds.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
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