How many foreign key to be created in table in sql server

Posted by Jitendrasoft09 under Sql Server on 6/26/2013 | Points: 10 | Views : 699 | Status : [Member] [MVP] | Replies : 2
Hi All,
I want to understand How many foreign key to be created in table in sql server, let me know if anybody knows.

Jitendra Kumar
If my post helps you, plz mark as an answer.



Responses

Posted by: Pandians on: 6/26/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Check It Out for Capacity on SQL Server : http://msdn.microsoft.com/en-us/library/ms143432.aspx

Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neeraaj.Sharma on: 6/28/2013 [Member] Starter | Points: 25

Up
0
Down

Mark as Answer it this helps:

Short answer as much as possible.

One table can have as much as possible foreign keys , but recommended not to have more than 253 FK in a table as recommended by BOL.


example below:



Create table masterproduct (productid int primary key , productdescription varchar(50))

Create table mastersubprocuct (productsubid int primary key , productdescription varchar(50))
GO

create table saledata (productid int FOREIGN KEY REFERENCES masterproduct(productid)
,productsubid int FOREIGN KEY REFERENCES mastersubprocuct(productsubid)
, saleqty int )


drop table masterproduct
drop table mastersubprocuct
drop table saledata




Visit my blog www.tutorialsqlserver.com






Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response