Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » MobiLink - Server Administration » MobiLink Reference » MobiLink data mappings between remote and consolidated databases

 

Microsoft SQL Server data mapping

Mapping to Microsoft SQL Server consolidated data types

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)

VARBINARY(MAX)

BIT

BIT

CHAR(n<=8000)

VARCHAR(n)

CHAR(n>8000)

VARCHAR(MAX)

DATE

DATE

DATETIME

DATETIME2

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, we suggest you round the fractional second to 1 microsecond.

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

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)

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)

NVARCHAR(MAX)

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. 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

VARCHAR(MAX)

TIME

TIME

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, we suggest you round the fractional second to 1 microsecond.

TIMESTAMP

DATETIME2

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, we suggest you round the fractional second to 1 microsecond.

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 SQL Server 2005, use XML. For other versions, use VARCHAR(MAX).

Mapping to SQL Anywhere or UltraLite remote data types

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, please 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

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. To successfully synchronize DATETIME, you should round the fractional second to 10 milliseconds. The year must be in the range 1753-9999.

DATETIME2

TIMESTAMP

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, we suggest you round the fractional second to 1 microsecond.

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.

NVARCHAR(MAX)

LONG NVARCHAR

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. 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

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, we suggest 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.

TINYINT

TINYINT

UNIQUEIDENTIFIER

UNIQUEIDENTIFIER

VARBINARY(n)

VARBINARY(n)

VARBINARY(MAX)

LONG BINARY

VARCHAR(n)

VARCHAR(n)

VARCHAR(MAX)

LONG VARCHAR

XML

XML