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
 New to SQL Server Administration
 Foreign Key constraints

Author  Topic 

jim_jim
Constraint Violating Yak Guru

306 Posts

Posted - 2010-05-21 : 10:06:18
I want to know whether SQL server 2005 automatically creates Primary key and Foreign Key constraints.

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-05-21 : 10:09:42
Automatically? What u mean? automatic here?

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

vijays3
Constraint Violating Yak Guru

354 Posts

Posted - 2010-05-21 : 14:04:25
No it does not
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-21 : 14:06:26
SQL Server has no way to know where you want constraints. You have to add them manually. SQL Server will automatically add an index to the PK constraint, but it does not do this for FK constraints. For this reason, you should manually add indexes that "match" the FK constraints.

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

Subscribe to my blog
Go to Top of Page
   

- Advertisement -