Replicating ntext datatypes

Microsoft SQL Server stores double-byte ntext datatype values in little-endian byte order. By default, the byte order of ntext data is converted during replication to big-endian so that the data may be transmitted over networks using big-endian, which is the common network byte order.

If the target database is also Microsoft SQL Server, Microsoft SQL Server does not automatically convert the replicated data from the sent big-endian order to the little-endian order desired by Microsoft SQL Server. To support replicating ntext data to a Microsoft SQL Server (or other replicate server that does not provide the necessary conversion), you may force the byte order to be sent using the lr_ntext_byte_order property by specifying a value of big (for big-endian) or little (for little-endian) as desired to meet the expectations of your replicate database.

The lr_ntext_byte_order parameter is available for Microsoft SQL Server, and Oracle and is especially important for replication between two different database types and between databases that reside on different platforms. For example, for replication between two Microsoft SQL Server databases, both the primary and replicate database store data in little-endian byte order because Microsoft SQL Server only runs on Windows. Therefore, the lr_ntext_byte_order parameter should be set to little. However, if the replicate database is not a Microsoft SQL Server, you should determine its byte order and set the lr_ntext_byte_order parameter accordingly.

NoteThe default behavior of Replication Agent for Microsoft SQL Server is to force any unicode data to big-endian order as defined by the ltl_big_endian_unitext configuration property. To allow the lr_ntext_byte_order configuration property to successfully override the Microsoft SQL Server byte order, you must also set ltl_big_endian_unitext configuration property to false whenever the lr_ntext_byte_order property is used.

The ltl_big_endian_unitext parameter specifies whether unitext data should be converted from little-endian to big-endian before sending LTL to Replication Server. Valid values are true and false. When setting this parameter, you must know how the lr_ntext_byte_order parameter is set. If the lr_ntext_byte_order parameter is set to send the correct byte order for the replicate database, the ltl_big_endian_unitext parameter must be set to false so that the byte order is not changed.

The ltl_big_endian_unitext and lr_ntext_byte_order configuration properties have important differences. By default, the ltl_big_endian_unitext property is true. When the ltl_big_endian_unitext property is true, Replication Agent for Microsoft SQL Server ensures all unicode data is sent in big-endian order. When the ltl_big_endian_unitext property is false, Replication Agent for Microsoft SQL Server allows unicode data to be sent in whatever byte order is used when the data is stored in the transaction log file. The lr_ntext_byte_order property forces the result of unicode data read from the transaction log to be in the requested byte order, regardless of how it normally exists in the transaction log file.