Database Design Considerations: Data Types

Optimizing SQL Database Performance

Optimizing Database Performance

Database Design Considerations: Data Types

SQL Server 2000 treats any fixed-length column that allows null values as fixed-length. Therefore, a char column that allows null values is treated as a fixed-length char column. As a result, the same data takes more disk space to store and can require more I/O and other processing operations in SQL Server 2000 compared to earlier versions of SQL Server. To resolve this issue , use variable-length columns rather than fixed-length columns. For example, use a varchar data type instead of a char data type. However, if all the values in a column are the same length or the lengths of the values do not vary by much, it is more efficient to use a fixed-length column.

Text Data Types

Character strings up to 8,000 bytes in length can be stored in columns defined with the char and varchar data types. Using a char or varchar data type allows the system-defined character string functions, such as SUBSTRING, to be used on character strings up to 8,000 bytes in length.

See Also

Specifying a Column Data Type