This is a discussion on Re: Should the CREATE TABLE statement include CONSTRAINTS? within the SQL Server forums, part of the Microsoft SQL Server category; --> Jason Berkan (jason_berkan@canada.com) writes: > Forgive me if this question has an obvious answer, but I am trying to ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Jason Berkan (jason_berkan@canada.com) writes: > Forgive me if this question has an obvious answer, but I am trying to > figure out the "best practices" for designing a database, and am > fairly new to SQL/relational databases, having worked with flat file > databases for years. > > When you write the CREATE TABLE statements for a database, should you > include the constraints as part of the create statement, or should the > constraints be added later via ALTER TABLE statements? Practice is likely to vary from site to site. I go for having all constraints except foreign keys in the CREATE TABLE statement. Foreign-key constraints I put in a file on their own, so when I bulid a database, I can load the tables in any order and apply foreign keys later. -- Erland Sommarskog, SQL Server MVP, sommar@algonet.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp |