Specifying a Column Data Type

Assigning a data type to each column is one of the first steps to take in designing a table. Data types define the data value that is allowed for each column. To assign a data type to a column, you can use Microsoft® SQL Server™ data types or create your own user-defined data types based on these system data types. For example, if you want to include only names in a column, you can assign a character data type to the column. Similarly, if you want a column to contain only numbers, you can assign a numeric data type.

Enforcing Data Integrity

System and user-defined data types can be used to enforce data integrity, because the data that is entered or changed must conform to the type that is specified in the original CREATE TABLE statement. For example, you would not be able to store a surname in a column defined as datetime because a datetime column accepts only valid dates. For the most part, keep numeric data in numeric columns, especially if calculations must be performed on the numeric data at a later date.

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.