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

Approximate Numeric Datatypes

This set of datatypes represents an approximate value. The data stored in these types of columns is approximate because it depends upon the specific processor architecture and also the number of significant digits used in a calculation. The real datatype can store a wide range of values. Depending upon the specific processor architecture SQL Server is running on, you could find that you are not able to utilize the entire range of possible values.

Datatype Range of values Storage Space
real -3.438 to 3.438 4 bytes
float(n) -1.7308 to 1.7308 n bytes up to a max of 8 bytes

Date/Time Data

SQL Server does not store dates and time separately. Both the date and time portions are stored in the same column. The first half of the storage space is used for the date and the second half for the time portion. Time is stored to an accuracy of 1/300th of a second.

Since year 2000 issues always come up when discussing date data, it should be noted that SQL Server 7.0 is fully year 2000 compliant. The year 2000 problem mainly occurs in applications. Even though SQL Server is year 2000 compliant, if you couple it with an application that is not year 2000 compliant, you will have the same problems. If your application only passes 2 digit years, SQL Server will use a standard algorithm to determine which century to store the data as. If the value is between 0 and 49, then it will be stored as 2000 to 2049. If the value is between 50 and 99, then it will be stored as 1950 to 1999.

Datatype Range of values Storage Space
datetime 1/1/1753 to 12/31/9999 8 bytes
smalldatetime 1/1/1900 to 6/6/2079 4 bytes

Money Datatypes

There are two specialized datatypes for storing monetary data. In most cases, a smallmoney datatype is sufficient. If you need to store values similar ot the US national debt, you will need to use a money datatype. You will note that these columns allow you to store values to 1/100 of a cent. Any data stored to this precision will calculate correctly, but you must be aware that many applications will round this off to two decimal places.

When storing information in these columns, you do not need to specify a monetary symbol. However, this does have an effect on the storage of the data. If you insert the value 6,134.73, it will be stored as a floating point number. If instead you insert the value $6,134.73 it will be stored as exact numeric value.

Datatype Range of values Storage Space
money -922,337,203,685,477.5808 to 922,337,203,685,477.5807 8 bytes
smallmoney -214,748.3648 to 214,748.3647 4 bytes

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.