The following table identifies how SQL Anywhere and UltraLite remote data types are mapped to Microsoft SQL Server consolidated data types. For example, a column of type DATETIME on the remote database should be type DATETIME2 on the consolidated database.
SQL Anywhere or UltraLite data type | Microsoft SQL Server data type | Notes |
---|---|---|
BIGINT |
BIGINT |
|
BINARY(n<=8000) |
VARBINARY(n) |
|
BINARY(n>8000) |
VARBINARY(MAX) |
|
BIT |
BIT |
|
CHAR(n<=8000) |
VARCHAR(n) |
|
CHAR(n>8000) |
VARCHAR(MAX) |
|
DATE |
DATE |
|
DATETIME |
DATETIME2 |
Microsoft SQL Server DATETIME2 and TIME values are accurate to 100 nanoseconds. However, TIMESTAMP and TIME values are only accurate to 1 microsecond. To successfully synchronize DATETIME2 and TIME, it is recommended that you round the fractional second to 1 microsecond. |
DECIMAL(p=<38,s) |
DECIMAL(p,s) |
Microsoft SQL Server DECIMAL/NUMERIC precision ranges from 1 to 38, so p must be less than 39. |
DECIMAL(p>38,s) |
There is no corresponding data type in Microsoft SQL Server. |
|
DOUBLE |
FLOAT(53) |
|
FLOAT(p) |
FLOAT(p) |
|
IMAGE |
VARBINARY(MAX) |
|
INTEGER |
INT |
|
LONG BINARY |
VARBINARY(MAX) |
|
LONG NVARCHAR |
NVARCHAR(MAX) |
|
LONG VARBIT |
VARCHAR(MAX) |
|
LONG VARCHAR |
VARCHAR(MAX) |
|
MONEY |
MONEY |
|
NCHAR(n<=4000) |
NVARCHAR(c) |
|
NCHAR(n>4000) |
NVARCHAR(MAX) |
|
NTEXT |
NVARCHAR(MAX) |
|
NUMERIC(p=<38,s) |
NUMERIC(p,s) |
Microsoft SQL Server DECIMAL/NUMERIC precision ranges from 1 to 38, so p must be less than 39. |
NUMERIC(p>38,s) |
There is no corresponding data type in Microsoft SQL Server. |
|
NVARCHAR(n<=4000) |
NVARCHAR(c) |
|
NVARCHAR(n>4000) |
NVARCHAR(MAX) |
|
REAL |
REAL |
|
SMALLDATETIME |
SMALLDATETIME |
SQL Anywhere and UltraLite SMALLDATETIME is implemented as TIMESTAMP. Microsoft SQL Server SMALLDATETIME is accurate to the minute. 29.998 seconds or lower are rounded down to the nearest minute; values with 29.999 seconds or higher are rounded up to the nearest minute. SQL Anywhere or UltraLite SMALLDATETIME is accurate to the microsecond. To successfully synchronize, SQL Anywhere or UltraLite SMALLDATETIME must be rounded to the minute. The year must be in the range 1900-2078. |
SMALLINT |
SMALLINT |
|
SMALLMONEY |
SMALLMONEY |
|
ST_GEOMETRY |
GEOMETRY |
|
TEXT |
VARCHAR(MAX) |
|
TIME |
TIME |
Microsoft SQL Server DATETIME2 and TIME values are accurate to 100 nanoseconds. However, TIMESTAMP and TIME values are only accurate to 1 microsecond. To successfully synchronize DATETIME2 and TIME, it is recommended that you round the fractional second to 1 microsecond. |
TIMESTAMP |
DATETIME2 |
Microsoft SQL Server DATETIME2 and TIME values are accurate to 100 nanoseconds. However, TIMESTAMP and TIME values are only accurate to 1 microsecond. To successfully synchronize DATETIME2 and TIME, it is recommended that you round the fractional second to 1 microsecond. |
TIMESTAMP WITH TIME ZONE | DATETIMEOFFSET | |
TINYINT |
TINYINT |
For download, values must be non-negative. |
UNIQUEIDENTIFIER |
UNIQUEIDENTIFIER |
|
UNIQUEIDENTIFIERSTR |
UNIQUEIDENTIFIER |
|
UNSIGNED BIGINT |
NUMERIC(20) |
For download, values must be non-negative. |
UNSIGNED INTEGER |
NUMERIC(11) |
For download, values must be non-negative. |
UNSIGNED TINYINT |
TINYINT |
For download, values must be non-negative. |
UNSIGNED SMALLINT |
INT |
For download, values must be non-negative. |
VARBINARY(n<=8000) |
VARBINARY(n) |
|
VARBINARY(n>8000) |
VARBINARY(MAX) |
|
VARBIT(n<=8000) |
VARCHAR(n) |
|
VARBIT(n>8000) |
VARCHAR(MAX) |
|
VARCHAR(n<=8000) |
VARCHAR(c) |
|
VARCHAR(n>8000) |
VARCHAR(MAX) |
|
XML |
XML or VARCHAR(MAX) |
For Microsoft SQL Server 2005, use XML. For other versions, use VARCHAR(MAX). |
The following table identifies how Microsoft SQL Server consolidated data types are mapped to SQL Anywhere and UltraLite remote data types. For example, a column of type TEXT on the remote database should be type LONG VARCHAR on the consolidated database.
Microsoft SQL Server data type | SQL Anywhere or UltraLite data type | Notes |
---|---|---|
BIGINT |
BIGINT |
|
BINARY(n) |
BINARY(n) |
|
BIT |
BIT |
|
CHAR(n) |
VARCHAR(n) |
A Microsoft SQL Server CHAR column is blank padded. A SQL Anywhere CHAR column is not blank padded by default and is equivalent to a VARCHAR column. Therefore, try to avoid using the CHAR data type in the synchronization tables in Microsoft SQL Server. If you must use the CHAR data type in the Microsoft SQL Server consolidated database, run the MobiLink server with the -b command line option to help resolve the differences between SQL Anywhere CHAR and non-SQL Anywhere CHAR. |
DATE |
DATE |
|
DATETIME |
TIMESTAMP or DATETIME |
Microsoft SQL Server DATETIME values are accurate to 1/300 second. The last digit of the fractional second is always 0, 3, or 6. Other digits are rounded to one of these three digits, so, 0 and 1 round to 0; 2, 3, and 4 round to 3; 5, 6, 7, and 8 round to 6; and 9 rounds to 10. For download, SQL Anywhere keeps the original values from Microsoft SQL Server, but for upload, the values may not be exactly the original values. If DATETIME is used for a primary key, conflict resolution may fail. To successfully synchronize DATETIME, you should round the fractional second to 10 milliseconds. The year must be in the range 1753-9999. |
DATETIME2 |
TIMESTAMP |
Microsoft SQL Server DATETIME2 and TIME values are accurate to 100 nanoseconds. However, TIMESTAMP and TIME values are only accurate to 1 microsecond. To successfully synchronize DATETIME2 and TIME, it is recommended that you round the fractional second to 1 microsecond. |
DECIMAL(p,s) |
DECIMAL(p,s) |
|
FLOAT(p) |
FLOAT(p) |
|
GEOMETRY |
ST_GEOMETRY | |
IMAGE |
LONG BINARY |
|
INT |
INT |
|
MONEY |
MONEY |
|
NCHAR(n) |
NVARCHAR(c) |
Not available in UltraLite. There is no equivalence between SQL Anywhere NCHAR and non-SQL Anywhere NCHAR. SQL Anywhere NCHAR is equivalent to NVARCHAR. You should not use NCHAR in a consolidated database column that is synchronized. If you must use non-SQL Anywhere NCHAR, run the MobiLink server with the -b option. |
NTEXT |
LONG NVARCHAR |
Not available in UltraLite. |
NVARCHAR(c) |
NVARCHAR(c) |
Not available in UltraLite. |
NVARCHAR(MAX) |
LONG NVARCHAR |
Not available in UltraLite. |
NUMERIC(p,s) |
NUMERIC(p,s) |
|
REAL |
REAL |
REAL can cause problems if the consolidated and remote databases don't allow the exact same (imprecise) values. iAnywhere Solutions does not test all possible values, so care must be taken. To avoid problems, do not use these types as part of a primary key. |
SMALLDATETIME |
SMALLDATETIME |
SQL Anywhere and UltraLite SMALLDATETIME is implemented as TIMESTAMP. Microsoft SQL Server SMALLDATETIME is accurate to the minute. 29.998 seconds or lower are rounded down to the nearest minute; values with 29.999 seconds or higher are rounded up to the nearest minute. SQL Anywhere or UltraLite SMALLDATETIME is accurate to the microsecond. To successfully synchronize, SQL Anywhere or UltraLite SMALLDATETIME must be rounded to the minute. The year must be in the range 1900-2078. |
SMALLINT |
SMALLINT |
|
SMALLMONEY |
SMALLMONEY |
|
TEXT |
LONG VARCHAR |
|
TIME |
TIME |
Microsoft SQL Server DATETIME2 and TIME values are accurate to 100 nanoseconds. However, TIMESTAMP and TIME values are only accurate to 1 microsecond. To successfully synchronize DATETIME2 and TIME, it is recommended that you round the fractional second to 1 microsecond. |
TIMESTAMP |
VARBINARY(8) |
Within Microsoft SQL Server, TIMESTAMP is a binary counter that gets incremented with every change to a row. So, each table can only contain one TIMESTAMP column and it does not make sense to synchronize it. If it must be in a synchronization, map it to a VARBINARY(8) data type in SQL Anywhere or UltraLite. This TIMESTAMP column cannot be explicitly inserted or updated, because it is maintained by the server. Keep this in mind when you are implementing upload scripts for tables that contain such columns. |
DATETIMEOFFSET | TIMESTAMP WITH TIME ZONE | |
TINYINT |
TINYINT |
|
UNIQUEIDENTIFIER |
UNIQUEIDENTIFIER |
|
VARBINARY(n) |
VARBINARY(n) |
|
VARBINARY(MAX) |
LONG BINARY |
|
VARCHAR(n) |
VARCHAR(n) |
|
VARCHAR(MAX) |
LONG VARCHAR |
|
XML |
XML |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |