SQL Server CE Books Online
Supported Data Types and Data Type Mappings

Supported Data Types and Data Type Mappings

The following table shows the data type mappings that are performed when replicating between Microsoft® SQL Server™ and Microsoft SQL Server 2000 Windows® CE Edition (SQL Server CE). The table lists mappings for each SQL Server data type and describes restrictions or special behaviors.

SQL Server data type SQL Server CE data type
bigint (int 8) bigint (int 8)
binary (n) binary (n) or image
If the length of the data is 510 bytes or less, SQL Server CE replication maps the SQL Server binary data to SQL Server CE binary; otherwise, it maps it to SQL Server CE image.
If the length of the image data exceeds the length of the binary column, synchronization fails when the data is sent from the SQL Server CE Subscriber to the SQL Server Publisher.
bit bit
character
(synonym:
char)
national character or ntext
If the length of the data is 255 characters or less, SQL Server CE replication maps the SQL Server character data to SQL Server CE national character ; otherwise, it maps it to SQL Server CE ntext.
If the length of the ntext data exceeds the length of the character column, synchronization fails when the data is sent from the SQL Server CE subscription to the SQL Server publication.
character varying
(synonyms:
char varying,
varchar)
national character varying or ntext
If the length of the data is 255 characters or less, SQL Server CE replication maps the SQL Server character varying data to SQL Server CE national character varying; otherwise, it maps it to SQL Server CE ntext .
If the length of the ntext data exceeds the length of the character varying column, synchronization fails when the data is sent from the SQL Server CE subscription to the SQL Server publication.
datetime datetime
decimal See numeric.
double precision double precision
float float
image image
integer (int 4)
(synonym:
int)
integer (int 4)
money money
national character
(synonyms:
national char,
nchar)
national character
If the length of the data is 255 characters or less, SQL Server CE replication maps the SQL Server national character data to SQL Server CE national character; otherwise, it maps it to SQL Server CE ntext.
If the length of the ntext data exceeds the length of the national character column, synchronization fails when the data is sent from the SQL Server CE subscription to the SQL Server publication.
national character varying
(synonyms:
national char varying, nvarchar)
national character varying
If the length of the data is 255 characters or less; SQL Server CE replication maps the SQL Server national character varying data to SQL Server CE national character varying; otherwise, it maps it to SQL Server CE ntext.
If the length of the ntext data exceeds the length of the national character varying column, synchronization fails when the data is sent from the SQL Server CE subscription to the SQL Server publication.
ntext ntext
numeric
(synonyms:
decimal, dec)
numeric
real real
smalldatetime datetime
If the precision of the datetime data exceeds the precision of the smalldatetime column, synchronization fails when the data is sent from the SQL Server CE subscription to the SQL Server publication.
smallint (int 2) smallint (int 2)
smallmoney money
If the precision of the money data exceeds the precision of the smallmoney column, synchronization fails when the data is sent from the SQL Server CE subscription to the SQL Server publication.
sql_variant sql_variant is mapped to ntext.
If binary data exists in the sql_variant column, the binary data must be an even number of bytes or a conversion error occurs.
text ntext
If the length of the text data exceeds 1,073,741,823 characters, synchronization fails when the data is sent from the SQL Server publication to the SQL Server CE subscription.
timestamp Not supported
Data stored as timestamp data is vertically partitioned out of all SQL Server CE Subscriptions.
tinyint (int 1) tinyint (int 1)
uniqueidentifier uniqueidentifier
varbinary (n) varbinary (n) or image
If the length of the data is 510 bytes or less, SQL Server CE replication maps the SQL Server varbinary data to SQL Server CE varbinary ; otherwise, it maps it to SQL Server CE image.
If the length of the image data exceeds the length of the varbinary column, synchronization fails when the data is sent from the SQL Server CE subscription to the SQL Server publication.
varchar See character varying

Choose data types that are supported by both SQL Server and SQL Server CE, so it is not necessary for replication to perform data mapping. When this is not possible, the application should validate the values stored in SQL Server CE to ensure that replication can map these values between SQL Server and SQL Server CE.

You cannot publish a table having an index on char, nchar, varchar, or nvarchar columns with lengths greater than 255. Creation of the SQL Server CE subscription fails because these column types are mapped to ntext, and a primary key cannot be created on an ntext column.

For more information about SQL Server data types, see "Data Types" in SQL Server Books Online.

See Also

Replication Limitations

Page view tracker