Table 1 lists
the more common SQL Server 7.0 datatypes.
Table 1.
The more common SQL Server 7.0 datatypes.
Datatype | Description |
Binary | Fixed length binary data (8000 bytes max) |
Bit | Either 0 or 1 (minimum 1 byte) |
Char | Fixed length, non-unicode data (8000 bytes max) |
Datetime | Date and time data with an accuracy of 3.33 ms. (8 bytes) |
Decimal | Fixed precision data with a range of -10^38 to 10^38 -1 (5-17 bytes depending on the precision) |
Float | Approximate precision data with a range of -1.79E+308 to 1.79E+308 (4-8 bytes) |
Int | Integer data with a range of -2^31 to 2^31 - 1 (4 bytes) |
Image | Variable length binary data (2^31 - 1 bytes max) |
Money | Currency values with a fixed scale of four (8 bytes) |
nChar | Fixed length, unicode data (4000 bytes max) |
nVarchar | Variable length, unicode data (4000 bytes max) |
nText | Variable length, unicode data (2^30 -1 bytes max) |
Real | Approximate precision data with a range of -3.4E+38 to 3.4E+38 (4 bytes) |
Smalldatetime | Date and time data with an accuracy of one minute (4 bytes) |
Smallint | Integer data with a range of -2^15 to 2^15 - 1 (2 bytes) |
SmallMoney | Currency value with a fixed scale of four (4 bytes) |
Text | Variable length, non-unicode data (2^31 - 1 bytes max) |
Timestamp | A value unique to the database and updated whenever a column changes (8 bytes) |
Tinyint | Integer data with a range of 0 to 255 (1 byte) |
Uniqueidentifier | A globally unique identifer |
Varbinary | Variable length binary data (8000 bytes max) |
Varchar | Variable length, non-unicode data (8000 bytes max) |
|
|
Field_name | Field_type | Field_len | Field_dec |
T_BINARY | M | 4 | 0 |
T_BIT | L | 1 | 0 |
T_DATETIME | T | 8 | 0 |
T_DECIMAL | N | 7 | 2 |
T_FLOAT | B | 8 | 2 |
T_IMAGE | G | 4 | 0 |
T_INT | I | 4 | 0 |
T_MONEY | Y | 8 | 4 |
T_NCHAR | C | 5 | 0 |
T_NTEXT | C | 255 | 0 |
T_NVARCHAR | C | 5 | 0 |
T_REAL | B | 8 | 2 |
T_SMALLDATETIME | T | 8 | 0 |
T_SMALLINT | I | 4 | 0 |
T_SMALLMONEY | Y | 8 | 4 |
T_TEXT | M | 4 | 0 |
T_TIMESTAMP | M | 4 | 0 |
T_TINYINT | I | 4 | 0 |
T_VARBINARY | M | 4 | 0 |
T_VARCHAR | C | 5 | 0 |
T_UNIQUEIDENTIFIER | C | 36 | 0 |
|
The end
Hopefully, I've provided additional insight
into the datatypes that both SQL Server and VFP offer. Having a clear-cut
example of how the datatypes of the two systems interact should make it
easier to design and predict the data-transformation behavior of your applications.
Michael Levy is a consultant with
ISResearch, Inc., a Microsoft Solution Provider and Certified Technical
Education Center. He's a Microsoft Certified Solution Developer and Trainer.
Michael specializes in using Visual Studio and SQL Server to solve business
problems. mlevy@isresearch.com.
Sidebar: The Unicode Standard
The problem with using a single byte to
encode a character is that only 256 characters can be represented. In order
to support multiple alphabets, different encoding schemes (code pages) must
be created. The Unicode standard was developed with the primary goal of
providing one character-encoding scheme for all alphabetic characters, ideographic
characters, and symbols. Using a 16-bit encoding scheme enables a total
of over 65,000 characters to be encoded. Currently, version 2 of the Unicode
standard contains more than 38,000 characters and symbols from the world's
languages and mathematics.
SQL Server 7.0 includes three new datatypes for storing Unicode data: nchar,
nvarchar, and ntext (the prefix n comes from the SQL
92 standard for National datatypes). The Unicode datatypes are identical
to their non-Unicode cousins, except they take up more space and can only
store half as much data (4000 bytes vs. 8000 bytes).
For more information about the Unicode Standard, visit the Unicode Consortium
Web site at >http://www.unicode.org.