Microsoft KB Archive/171285

From BetaArchive Wiki
Knowledge Base


BUG: NULL Padding Behavior Different on Subscriber

Article ID: 171285

Article Last Modified on 10/3/2003



APPLIES TO

  • Microsoft SQL Server 6.5 Standard Edition



This article was previously published under Q171285

BUG #: 17047 (Windows NT: 6.5)

SYMPTOMS

Subscriber tables may be created with ANSI_PADDING turned ON, sometimes causing undesirable behavior with NULLable fixed-length columns (char, binary, and so on) at the subscriber. This may also be perceived as incorrect data at the subscriber. The data that is copied over during the initial synchronization does not have this problem because it uses DB-Library to connect to the subscriber to apply the BCP data and the default behavior for these SET options is OFF.

CAUSE

In SQL 6.5, the ODBC driver (build 2.65.0240) automatically sets the following option:

   SET ANSI_DEFAULTS ON
                


This option enables the ANSI_PADDING option. This causes the tables at the subscriber to exhibit this behavior even if ANSI_PADDING is turned OFF during INSERT operations.

The workaround for this problem is to edit the schema files (.sch files in the replication working directory) immediately after creating the publication to include the following statements before the CREATE TABLE statement:

SET ANSI_DEFAULTS OFF
go
                


At the end of the script, after the CREATE statements, add the following statements:

SET ANSI_DEFAULTS ON
go
                


This reverts back to ANSI standard behavior for the other statements to follow. If you do not add the SET ANSI_DEFAULTS ON statement, subsequent statements may fail because the replication process expects this option to be turned ON.


STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Additional query words: blank spaces suffixed dblib db-lib

Keywords: kbbug kbinterop kbprogramming kbsqlserv650bug KB171285