December 2002
Intermediate to advanced
1560 pages
40h 44m
English
Datatypes define the type of data that can be stored in tables. When each column is defined, it is assigned a datatype, which enforces basic integrity by limiting the type and size of the data that can be entered. Choosing the correct datatype for each column is crucial to efficient data storage, performance, and application compliance.
SQL Server provides several base datatypes, which are grouped by the type of data that they store. Table 12.2 shows the system-supplied datatypes and their storage capacities.
| Data Type Category | SQL Server Data Type | Number of Bytes |
|---|---|---|
| Character |
char[(n)] varchar[(n)] text | 0–8000 0–2GB |
| Unicode Character |
nchar[(n)] nvarchar[(n)] ntext | 0–8000
(4000 characters) 0–2GB ... |
Read now
Unlock full access