Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Schema without FK relationship, is it OK Expand / Collapse
Author
Message
Posted Friday, April 18, 2014 12:02 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: 2 days ago @ 9:19 AM
Points: 150, Visits: 370
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
Post #1563125
Posted Friday, April 18, 2014 12:33 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 3:21 PM
Points: 13,083, Visits: 11,918
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)
Post #1563137
Posted Friday, April 18, 2014 12:37 PM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 3:11 PM
Points: 15,517, Visits: 27,898
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 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1563138
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse