Export (0) Print
Expand All

Specifying a Column Data Type

SQL Server 2000

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 allowed for each column. To assign a data type to a column, you can use Microsoft® SQL Server™ 2000 base 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. For more information about user-defined data types, see Creating User-Defined Data Types.

SQL Server also supports SQL-92 synonyms for several base data types. For more information, see Data Type Synonyms.

Enforcing Data Integrity

System and user-defined data types can be used to enforce data integrity, because the data entered or changed must conform to the type specified in the original CREATE TABLE statement. For example, you cannot 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.

Show:
© 2014 Microsoft