Tables are the heart of relational databases in general and of SQL Server in particular. In this chapter, we've looked at datatype issues, including size and performance tradeoffs. SQL Server provides a datatype for almost every use. We've looked at variable-length datatype issues and seen that it's simplistic to think that variable-length datatypes are either always good or always bad to use. We've also seen how data is physically stored in data pages and discussed some of the system table entries that are made to support tables.
SQL Server provides user -defined datatypes for support of domains, and it provides the Identity property to make a column produce autosequenced numeric values. SQL Server also provides constraints offering a powerful way to ensure your data's logical integrity. In addition to the NULL/NOT NULL designation, SQL Server provides PRIMARY KEY, UNIQUE, FOREIGN KEY, CHECK, and DEFAULT constraints. The discussion of these features also touched on a number of pragmatic issues, such as performance implications, conflicts between different constraints and triggers, and transaction semantics when a constraint fails.
To get the most out of SQL Server, you must understand tables, datatypes, and constraints. This chapter has provided some insight into subtleties that you might not have gleaned from the reference documentation of these features.