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 DATE on the remote database should be type DATETIME 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) |
IMAGE |
|
BIT |
BIT |
|
CHAR(n<=8000) |
VARCHAR(n) |
|
CHAR(n>8000) |
TEXT |
|
DATE |
DATETIME |
The year must be in the range 1753-9999. |
DATETIME |
DATETIME |
SQL Server DATETIME values are accurate to 333.33 microseconds. The last digit of the fractional second is always rounded to one of 0, 3, or 7, so 0 and 1 round to 0; 2, 3, and 4 round to 3; 5, 6, 7, and 8 round to 7; and 9 rounds to 10. For download, SQL Anywhere keeps the original values from SQL Server, but for upload, the values may not be exactly the original values. Conflict resolution may fail. To successfully synchronize DATETIME, you can round the fractional second to 10 milliseconds. The year must be in the range 1753-9999. |
DECIMAL(p=<38,s) |
DECIMAL(p,s) |
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 SQL Server. |
|
DOUBLE |
FLOAT(53) |
|
FLOAT(p) |
FLOAT(p) |
|
IMAGE |
IMAGE |
|
INTEGER |
INT |
|
LONG BINARY |
IMAGE |
|
LONG NVARCHAR |
NTEXT |
|
LONG VARBIT |
TEXT |
|
LONG VARCHAR |
TEXT |
|
MONEY |
MONEY |
|
NCHAR(n<=4000) |
NVARCHAR(c) |
|
NCHAR(n>4000) |
NTEXT |
|
NTEXT |
NTEXT |
|
NUMERIC(p=<38,s) |
NUMERIC(p,s) |
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 SQL Server. |
|
NVARCHAR(n<=4000) |
NVARCHAR(c) |
|
NVARCHAR(n>4000) |
NTEXT |
|
REAL |
REAL |
|
SMALLDATETIME |
SMALLDATETIME |
SQL Anywhere and UltraLite SMALLDATETIME is implemented as TIMESTAMP. 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. In order 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 |
TEXT |
|
TIME |
DATETIME |
SQL Server TIME values are accurate to 333.33 microseconds. The last digit of the fractional second is always rounded to one of 0, 3, or 7, so 0 and 1 round to 0; 2, 3, and 4 round to 3; 5, 6, 7, and 8 round to 7; and 9 rounds to 10. For download, SQL Anywhere keeps the original values from SQL Server, but for upload, the values may not be exactly the original values. Conflict resolution may fail. To successfully synchronize TIME, you can round the fractional second to 10 milliseconds. The year must be in the range 1753-9999. |
TIMESTAMP |
DATETIME |
SQL Server DATETIME values are accurate to 333.33 microseconds. The last digit of the fractional second is always rounded to one of 0, 3, or 7, so 0 and 1 round to 0; 2, 3, and 4 round to 3; 5, 6, 7, and 8 round to 7; and 9 rounds to 10. For download, SQL Anywhere keeps the original values from SQL Server, but for upload, the values may not be exactly the original values. Conflict resolution may fail. To successfully synchronize DATETIME, you can round the fractional second to 10 milliseconds. The year must be in the range 1753-9999. |
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) |
IMAGE |
|
VARBIT(n<=8000) |
VARCHAR(n) |
|
VARBIT(n>8000) |
TEXT |
|
VARCHAR(n<=8000) |
VARCHAR(c) |
|
VARCHAR(n>8000) |
TEXT |
|
XML |
XML or TEXT |
For SQL Server 2005, use XML. For other versions, use TEXT. |
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) |
There is no equivalence between SQL Anywhere CHAR and non-SQL Anywhere CHAR. SQL Anywhere CHAR is equivalent to VARCHAR. You should not use CHAR in a consolidated database column that is synchronized. If you must use non-SQL Anywhere CHAR, run the MobiLink server with the -b option. |
DATETIME |
TIMESTAMP or DATETIME |
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 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. In order to successfully synchronize DATETIME, you should round the fractional second to 10 milliseconds. The year must be in the range 1753-9999. |
DECIMAL(p,s) |
DECIMAL(p,s) |
|
FLOAT(p) |
FLOAT(p) |
|
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. |
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. We do 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. 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. In order 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 |
|
TIMESTAMP |
VARBINARY(8) |
Within Microsoft SQL Server, TIMESTAMP is a binary counter that gets incremented with every change to a row. Thus, 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. |
TINYINT |
TINYINT |
|
UNIQUEIDENTIFIER |
UNIQUEIDENTIFIER |
|
VARBINARY(n) |
VARBINARY(n) |
|
VARCHAR(n) |
VARCHAR(n) |
|
XML |
XML |
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |