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
 General SQL Server Forums
 Database Design and Application Architecture
 Foreign Key Storage

Author  Topic 

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-08-18 : 12:08:45
Hey All --

(I did some Googling but didn't find any good results on this)

Can anyone point me to a resource that explains how SQL Server physically stores foreign key constraints? For example, if I have:

create table A (AID varchar(100) primary key)
create table B (BID int identity primary key, AID varchar(100) references A(AID))

Does table B physically store 100 (potentially) characters of data for each foreign key reference to A(AID), or does it just store a pointer?

I think it stores pointers, but I am trying to confirm for sure.

Thanks!!

- Jeff
http://weblogs.sqlteam.com/JeffS

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-08-18 : 12:20:06
just a pointer.

well ok.. it's an object that stores pointers to a parent and child table row.


_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-08-18 : 13:40:18
Thanks, Mladen ... That's what I thought. Do you know of any place this is explained/documented online?

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

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-08-18 : 13:49:35
no... i've read it in the the book Inside SQL Server: The storage engine. IT says there that all constraints are objects. you can see them in sys.objects catalgo view. my logic dictates that the object stores pointers to the rows in both tables.



_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page
   

- Advertisement -