Unix Technical Forum

Re: Should the CREATE TABLE statement include CONSTRAINTS?

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 ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 06:40 PM
Erland Sommarskog
 
Posts: n/a
Default Re: Should the CREATE TABLE statement include CONSTRAINTS?

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:41 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com