Search
Home
Articles
Backup
Books
Certification
FAQ
Products
Replication
Scripts
Seminars
Training
TSQL

MSDN Fourms
Fort Worth SSUG
Oklahoma City SSDG

Resume

Champion Valley Pens

SQL Server 7.0 Datatypes 1 2 3 4 5 6

Text and Image Datatypes

In previous versions of SQL Server, it was considered a mortal sin to use a text or image datatype. There were a lot of restrictions on these datatypes and specialized functiosn had to be used to work with them. Because of all of the special handling required for text and image columns, table corruption was very frequent. However they were still used, simply because 255 characters was very limiting.

The good news is that text handling in SQL Server 7.0 has been dramatically improved. Text and image columns are now much more stable. Using a text column is no longer much of a problem, except the 8000 character limit on a simple char or varchar column reduces the need for a text column.

Datatype Range of values Storage Space
text 2 billion bytes of data Actual size rounded up to the nearest 8K
image 2 billion bytes of data Actual size rounded up to the nearest 8K

Binary Datatypes

Datatype Range of values Storage Space
binary(n) 1 to 8000 bytes of data n bytes
varbinary(n) 1 to 8000 bytes of data Actual size of data

Special Datatypes

There are a small number of specialized datatypes that can be used within SQL Server. One of the more commonly used datatypes is a timestamp. The name of this datatype is a misnomer. It does not store a time nor can you derive a time from it. It is a binary value based partly upon the system clock. This column affords you a unique value within your table. A column of this datatype is handled internally by SQL Server. Every insert and update will change the value in this column and no other row in the table will have the same value. An example of a timestamp value is: 0x01000000a3d2ae08. A new datatype introduced in SQL Server 7.0 is the uniqueidentifier. The uniqueidentifier is very similar to a timestamp datatype. The difference is in scope. A timestamp is unique within the table it is defined in. A uniqueidentifier is unique across all databases on the server. The sysname datatypes is included here for completeness. This datatype is used within the system tables and should not be used on any of your tables.

Datatype Range of values Storage Space
bit 0 or 1 1 bit
timestamp internally managed 8 bytes
uniqueidentifier internally managed 16 bytes
sysname nvarchar(128) Actual data size

SQL Server 7.0 Datatypes 1 2 3 4 5 6

Michael R. Hotek

All content on this site, except where noted, represents an original work of Michael R. Hotek and is protected by applicable copyright laws. The SQL Server FAQ is the sole work of Neil Pike. No page, portion of a page, or download may be used for commercial purposes in whole or in part without the express, written permission of the applicable author.