Microsoft SQL Server Data Types and MSSQLDRV Driver - cDbUpdateFunctionLibrary


The table show how SQL data types maps to DataFlex native types and the capacity of each type.  The capacity shown is the highest possible value for the DataFlex side - or if the SQL side max value is lower - the SQL side capacity that is shown. Mostly it is the DataFlex side that has the lower capacity value.


SQL Type Name

SQL Type Constant

DataFlex Type

DataFlex Type

Constant

Capacity






bigint

SQL_BIGINT

Numeric

DF_BCD

14.0

binary

SQL_BINARY

Binary

DF_BINARY

8000

bit

SQL_BIT

ASCII

DF_ASCII

1.0

char

SQL_TEXT

Text

DF_TEXT

8000

date

SQL_DATE

Date

DF_DATE

10.0

datetime

SQL_DATETIME

DateTime

DF_DATETIME

23.3

datetime2

SQL_TYPE_TIMESTAMP2

DateTime

DF_DATETIME

23.6

datetimeoffset

SQL_SS_TIMESTAMPOFFSET

DateTime

DF_DATETIME

34.0

decimal

SQL_DECIMAL

Numeric

DF_BCD

14.8

float

SQL_FLOAT

Numeric

DF_BCD

14.8

int

SQL_INTEGER

Numeric

DF_BCD

10.0

money

SQL_TYPE_MONEY

Numeric

DF_BCD

15.4

nchar

SQL_WCHAR

Text

DF_TEXT

4000

ntext

SQL_WLONGVARCHAR

Text

DF_TEXT

16384

numeric

SQL_NUMERIC

Numeric

DF_BCD

14.8

nvarchar

SQL_WVARCHAR

Text

DF_TEXT

4000

nvarchar(max)

SQL_VARCHARMAX

Text

DF_TEXT

16384

real

SQL_REAL

Numeric

DF_BCD

14.8

smalldatetime

SQL_TYPE_SMALLDATETIME

DateTime

DF_DATETIME

23.0

smallint

SQL_SMALLINT

Numeric

DF_BCD

5.0

smallmoney

SQL_TYPE_SMALLMONEY

Numeric

DF_BCD

10.0

text

SQL_TEXT

Text

DF_TEXT

8000

time

SQL_TIME

ASCII

DF_ASCII

19.0

tinyint

SQL_TINYINT

Numeric

DF_BCD

3.0

uniqueidentifier

SQL_GUID

ASCII

DF_ASCII

36

varbinary

SQL_VARBINARY

Binary

DF_BINARY

16384

varbinary(max)

SQL_LONGVARBINARY

Binary

DF_BINARY

16384

varchar

SQL_VARCHAR

Text

DF_TEXT

8000

varchar(max)

SQL_LONGVARCHAR

Text

DF_TEXT

16384

xml

SQL_SS_XML

Text

DF_TEXT

16384