Datatype compatibility

Replication Agent processes Microsoft SQL Server transactions and passes transaction information to the primary Replication Server.

The primary Replication Server uses the datatype formats specified in the replication definition to receive the data from Replication Agent.

Table 1-2 describes the default conversion of Microsoft SQL Server datatypes to Sybase Replication Server datatypes.

Table 1-2: Microsoft SQL Server to Replication Server default datatype mapping

Microsoft SQL Server datatype

Microsoft SQL Server length/range

Sybase datatype

Sybase length/range

Notes

bit

Integer with value of 0 or 1

bit

Integer with value of 0 or 1

bigint

-263 to 263 - 1

bigint

-263 to 263 - 1

int

-231 to 231 - 1

int

-231 to 231 - 1

smallint

Integer with value from -215 to 215 - 1

smallint

Integer with value from -215 to 215 - 1

tinyint

Integer with value from 0 to 255

tinyint

Integer with value from 0 to 255

decimal

Numeric from -1038 to 1038 - 1

decimal

Numeric from -1038 to 1038 - 1

numeric

Synonym for decimal datatype

numeric

Synonym for decimal datatype

money

Monetary from -263 to 263 - 1

money

Monetary from -263 to 263 - 1

smallmoney

Monetary from -214,748.3648 to 214,748.3647

smallmoney

Monetary from -214,748.3648 to 214,748.3647

float

Floating precision from -1.79E + 308 to 1.79E + 308

float

Floating precision from -1.79E + 308 to 1.79E + 308

Results in Sybase are machine dependent.

real

Floating precision from -3.40E + 38 to 3.40E + 38

real

Floating precision from -3.40E + 38 to 3.40E + 38

Results in Sybase are machine dependent.

datetime

Date and time from 01/01/1753 to 12/31/9999

datetime

Date and time from 01/01/1753 to 12/31/9999

smalldatetime

Date and time from 01/01/1900 to 06/06/2079

datetime

Date and time from 01/01/1900 to 06/06/2079

timestamp

Database-wide unique number

timestamp or varbinary

Database-wide unique number

For replication to Replication Server 15.0 and earlier versions, the Sybase datatype should be varbinary(8). For replication to Replication Server 15.1 or later, the Sybase datatype should be timestamp.

uniqueidentifier

Globally unique identifier

char

Globally unique identifier

No Sybase equivalent. Map to char(38).

char

Fixed length up to 8000 characters

char

32K

varchar

Variable length up to 8000 characters

varchar

32K

varchar(max)

Variable length up to 231 - 1 characters

text

2GB

text

Variable length up to 231 - 1 characters

text

2GB

nchar

Fixed length Unicode up to 4000 characters

unichar or char

32K

Actual maximum length is @@ncharsize * number of characters.

nvarchar

Variable length Unicode up to 4000 characters

univarchar or varchar

32K

Actual maximum length is @@ncharsize * number of characters.

nvarchar(max)

Variable length Unicode up to 230 - 1 characters

unitext or image

2GB

For Replication Server 15.0 and later versions, nvarchar(max) maps to unitext. For earlier versions of Replication Server, nvarchar(max) maps to image.

ntext

Variable length Unicode up to 230 - 1 characters

unitext or image

2GB

For Replication Server 15.0 and later versions, ntext maps to unitext. For earlier versions of Replication Server, ntext maps to image.

binary

Fixed length up to 8000 bytes

binary

32K

varbinary

Variable length up to 8000 bytes

varbinary

32K

image

Variable length up to 231 - 1 bytes

image

2GB

sql_variant

Any datatype except text, ntext, timestamp, and sql_variant, up to 8000 bytes

varchar or opaque

32K

For replication to Replication Server 15.0 and earlier versions, the Sybase datatype should be varchar. For replication to Replication Server 15.1 or later, the Sybase datatype should be opaque.