Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 referential integrity without foreign key

Author  Topic 

vamsimahi
Starting Member

29 Posts

Posted - 2008-04-21 : 19:15:11
What ate the method/techniques i can use for enforcing referential integrity, Without using foreign key constraints ?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-04-21 : 19:20:18
Triggers or via your application. Foreign key constraints are so much easier.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2008-04-25 : 04:32:19
and the actual constraints prevent orphaned data

if you try to manage it via application and someone with direct access made some db changes (oh some emergency shrinkage of db size), there goes your logical constraint

quote:
Originally posted by tkizer

Triggers or via your application. Foreign key constraints are so much easier.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/



--------------------
keeping it simple...
Go to Top of Page

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2008-04-25 : 04:39:11
What's preventing you from using FK constraints?

Mark
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-25 : 04:40:08
Interview question.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

vamsimahi
Starting Member

29 Posts

Posted - 2008-05-19 : 23:28:44
Right !! that was a interview question...
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2008-05-20 : 09:18:41
Thats the sort of interview question where if a candidate answered too quickly I wouldn't hire them. Like, if I ask them to recite the syntax for declaring a cursor, opening it, stepping through it, closing it, and deallocating it, and they can do it from memory.....I probably don't want them writing code for me!

e4 d5 xd5 Nf6
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-05-20 : 09:22:26
That's also the type of question where, if I was applying for a job and someone asked me that, I'd say: "Umm, on second thought, I don't think I am right for this job."

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -