The following table shows the data type mappings that are performed when replicating between SQL Server and Microsoft SQL Server Compact 3.5. The table lists mappings for each SQL Server data type and describes restrictions or special behaviors.
|
SQL Server Data Type
|
SQL Server Compact Data Type
|
|---|
|
bigint
|
Bigint
|
|
binary(n)
|
binary(n)
|
|
bit
|
Bit
|
|
character(n)(synonym: char(n))
|
national character(n) or ntext
If the length of the data is 4000 characters or less, SQL Server Compact replication maps the SQL Server character data to SQL Server Compact national character. Otherwise, it maps the character data to SQL Server Compact ntext. If the length of the ntext data exceeds the length of the character column, synchronization fails when the data is sent from SQL Server Compact to SQL Server.
|
|
character varying(n)(synonym: varchar(n))
|
national character varying or ntext
If the length of the data is 4000 characters or less, SQL Server Compact replication maps the SQL Server character varying data to SQL Server Compact national character varying; otherwise, it maps the character varying data to SQL Server Compact ntext. If the length of the ntext data exceeds the length of the character varying column, synchronization fails when the data is sent from SQL Server Compact to SQL Server.
|
|
character varying(MAX)(synonym: varchar(MAX))
|
ntext
If the length of the character varying(MAX) data exceeds the length of the ntext column, synchronization fails when the data is sent from SQL Server to SQL Server Compact.
|
|
Computed Columns
|
Not supported.
If you use the Publication wizard and indicate that SQL Server Compact subscriptions will be used, any column of the data type Computed Column is vertically partitioned out of the publication. If you do not use the wizard, you must exclude columns of this data type in the publication.
|
|
date
|
nchar(10) value of the form 'YYYY-MM-DD'
Note:
SQL Server Compact stores wide characters. Conversion support for this type was provided by the SQL Server Compact 3.5 SP1 release.
|
|
datetime
|
Datetime
|
|
datetime2
|
nvarchar(27) value of the form 'YYYY-MM-DD hh:mm:ss.nnnnnnn'
Note:
SQL Server Compact stores wide characters. Conversion support for this type was provided by the SQL Server Compact 3.5 SP1 release.
|
|
datetimeoffset
|
nvarchar(34) value of the form 'YYYY-MM-DD hh:mm:ss.nnnnnnn [+/-] hh:mm'
Note:
SQL Server Compact stores wide characters. Conversion support for this type was provided by the SQL Server Compact 3.5 SP1 release.
|
|
decimal
|
Not supported. Use numeric.
|
|
double precision
|
double precision
|
|
float
|
float
|
|
geography
|
image
Note:
Conversion support for this type was provided by the SQL Server Compact 3.5 SP1 release.
|
|
geometry
|
image
Note:
Conversion support for this type was provided by the SQL Server Compact 3.5 SP1 release.
|
|
image
|
image
|
|
integer(synonym: int)
|
integer
|
|
money
|
money
|
|
national character(n)(synonym: nchar(n))
|
national character(n)
|
|
national character varying(n)(synonym: nvarchar(n))
|
national character varying(n)
|
|
national character varying(MAX)(synonym: nvarchar(MAX))
|
ntext
If the length of the national character varying(MAX) data exceeds the length of the ntext column, synchronization fails when the data is sent from SQL Server to SQL Server Compact.
|
|
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 SQL Server Compact to SQL Server.
|
|
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 SQL Server Compact to SQL Server.
|
|
sql_variant
|
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 SQL Server to SQL Server Compact.
|
|
time
|
nvarchar(16) value of the form 'hh:mm:ss.nnnnnnn'
Note:
SQL Server Compact stores wide characters. Conversion support for this type was provided by the SQL Server Compact 3.5 SP1 release.
|
|
timestamp
|
Not supported.
If you use the Publication wizard and indicate that SQL Server Compact subscriptions will be used, any column of the data type timestamp is vertically partitioned out of the publication. If you do not use the wizard, you must exclude columns of this data type in the publication. If timestamp/rowversion column is not partitioned vertically, the data in this column is not replicated.
|
|
tinyint
|
tinyint
|
|
uniqueidentifier
|
uniqueidentifier
|
|
varbinary(n)
|
varbinary(n)
|
|
varbinary(MAX)
|
image
If the length of the varbinary(MAX) data exceeds the length of the image column, synchronization fails when the data is sent from SQL Server to SQL Server Compact.
|
|
varchar
|
See character varying
|
|
XML
|
ntext
|
Whenever possible, choose data types that are supported by both SQL Server and SQL Server Compact, so that it is not necessary for replication to perform data mapping. When this is not possible, your application should validate the values stored in the SQL Server Compact database to ensure that replication can map these values between SQL Server and SQL Server Compact.