Friday, October 23, 2009

What is the FOREIGN KEY in SQL Server?

FOREIGN KEYs are both a method of ensuring data integrity and a manifestation of the relationships between tables. When you add a FOREIGN KEY to a table, you create a dependency between the table for which you define the FOREIGN KEY (the referencing table) and the table your FOREIGN KEY references (the referred table). After adding a FOREIGN KEY, any record you insert into the referencing table must have a matching record in the referenced column(s) of the referenced table, or the value of the FOREIGN KEY column(s) must be set to NULL.

Share This!

No comments:

Powered By Blogger · Designed By Seo Blogger Templates