Author |
Topic |
cidr2
Starting Member
28 Posts |
Posted - 2008-11-26 : 08:57:45
|
Hi there,I'm puzzled by something I hope I can get help with.I'm working with an application that uses a SQL Server backend. There's over 40 tables. I decided to create a database diagram and to my confusion, non of the tables had a foriegn key constraint, In essence, there is only primary keys but non of the tables are related. I'm wondering if the front end app is doing all the work?Has anyone ever seen this? The data seems to hold integrity and I've not came accross any problems, yet. There must be a reason for this...Hope someone can help.thanks |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-11-26 : 11:31:49
|
Are those table Non-Normalized at all? |
 |
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2008-11-26 : 11:38:51
|
I have never seen a SQL Server with no FK's that defeat the whole ecense of SQL Server being a Relational Database |
 |
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2008-11-26 : 11:41:01
|
What kind of information is held in the database is there a reason that there wouldn't be a relationship at all...not that I could ever see the point might as well have one massive table in that case and sod it quick developement |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2008-11-26 : 14:23:32
|
quote: I have never seen a SQL Server with no FK's
Count yourself lucky, I see nothing but. Our in-house databases have them, but we've had 4-5 different 3rd party products and only one of them has foreign keys. One of the ones that doesn't have FK's does use triggers, that's likely because of cascading operations and they designed it in 7.0. We've had 1 or 2 that didn't have primary keys.Any time a dev team decides to add a database you can be absolutely certain it won't have foreign keys. It makes the app easier to write and troubleshoot/debug. Be thankful they're not storing all the data in huge chunks of XML. |
 |
|
Raibeart
Starting Member
8 Posts |
Posted - 2008-12-01 : 09:58:13
|
I work at a company that does software as a service. None of our tables have foreign keys established in the SQL database for referiential integrity. Per the owner., "The user needs to be able to do whatever they want with their data." It really sucks. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-01 : 10:00:21
|
quote: Originally posted by Raibeart I work at a company that does software as a service. None of our tables have foreign keys established in the SQL database for referiential integrity. Per the owner., "The user needs to be able to do whatever they want with their data." It really sucks.
i dont think thats a good approach. We have strict guidelines to use fk constraints wherever we want to maintain referiential integrity |
 |
|
jholovacs
Posting Yak Master
163 Posts |
Posted - 2008-12-02 : 15:23:35
|
I think foreign key constraints offer no benefit unless you have a bunch of monkeys working in your development shop, and even then they can be dangerous. FK constraints are not the purpose of a rdbms, they are available because it's a rdbms. Frankly there are all sorts of situations where FK's actually prevent you from doing things, and the cascading functionality in SQL Server is severely limited in that you can only have one update or delete path per cascading reference... that can seriously screw with your referential integrity.Give me a db without foreign keys any day. Much easier to maintain, and integrity can easily be controlled through transactional processing. ___________________________Geek At Large |
 |
|
cidr2
Starting Member
28 Posts |
Posted - 2008-12-04 : 10:59:41
|
OK, that's cleared up some stuff. The trasnactional processing method for integrity is one I've not heard of to date and will pay more attention to it. I could see, however, how that could work, perhaps the company responsable for the third party app has used this method. Or, maybe triggers.I'm sure they know what they're doing and I'll relax with that in mind.Thanks for the input on this. |
 |
|
|