Managed Data Type Mappings (SQL Server Compact)

Microsoft SQL Server Compact 4.0 does not fully support all .NET data types; when data is accessed by using ADO.NET, SQL Server Compact 4.0 must translate unsupported types to those that are supported.

Data Type Mappings

The following table shows the data type mappings between SQL Server Compact 4.0 and the .NET data provider.

.NET Data Type

SQL Server Compact Data Type

binary

varbinary

boolean

bit

byte

tinyint

byte[]

varbinary

datetime

datetime

decimal

numeric

double

float

guid

uniqueidentifier

image

image

int16

smallint

int32

int

int64

bigint

SqlBinary

varbinary

SqlBoolean

bit

SqlByte

tinyint

SqlDecimal¹

numeric

SqlDateTime

datetime

SqlDouble

float

SqlGuid

uniqueidentifier

SqlInt16

smallint

SqlInt32

int

SqlInt64

bigint

SqlMoney

money

SqlSingle

real

SqlString

nvarchar

single

real

string

nvarchar

¹ SQL Server Compact 4.0 supports SqlDecimal data type only up to 96 bits. If 96 bits are exceeded, SQL Server Compact throws an overflow exception error.

See Also

Reference

Data Types

Other Resources

Building Managed Applications (SQL Server Compact)