Microsoft KB Archive/815122

= BUG: Sp_addarticle Stored Procedure Failures Occur After You Apply SQL Server 2000 SP3 =

Article ID: 815122

Article Last Modified on 9/25/2003

-

APPLIES TO


 * Microsoft SQL Server 2000 Service Pack 3

-



BUG #: 364123 (SHILOH_BUGS)



SYMPTOMS
If the following conditions are true, the sp_addarticle stored procedure fails with errors after you apply SQL Server 2000 Service Pack 3 (SP3):
 * A unique key constraint exists on an Identity column, and the Identity column is not part of the primary key.
 * Column filtering for the article is enabled. For example:

@vertical_partition=N'true'
 * The publication has Queued Updating enabled. For example:

@allow_queued_tran=N'true'

You receive the following error messages when you run the sp_addarticle stored procedure on a computer that is running SQL Server 2000 SP3: Server: Msg 6401, Level 16, State 1, Procedure sp_MSgen_sync_tran_procs, Line 32 Cannot roll back gen_procs. No transaction or savepoint of that name was found. Server: Msg 266, Level 16, State 1, Procedure sp_MSgen_sync_tran_procs, Line 33 Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 2, current count = 3. Server: Msg 6401, Level 16, State 1, Procedure sp_articlesynctranprocs, Line 133 Cannot roll back sp_articlesynctranprocs. No transaction or savepoint of that name was found. Server: Msg 266, Level 16, State 1, Procedure sp_articlesynctranprocs, Line 134 Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 1, current count = 3. Server: Msg 266, Level 16, State 1, Procedure sp_addarticle, Line 1536 Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 0, current count = 2. Server: Msg 170, Level 15, State 1, Procedure sp_MSsync_ins_t2_1, Line 210 Line 210: Incorrect syntax near ')'. Server: Msg 156, Level 15, State 1, Procedure sp_MSsync_ins_t2_1, Line 254 Incorrect syntax near the keyword 'null'. Server: Msg 170, Level 15, State 1, Procedure sp_MSsync_ins_t2_1, Line 301 Line 301: Incorrect syntax near ')'. Server: Msg 170, Level 15, State 1, Procedure sp_MSsync_ins_t2_1, Line 369 Line 369: Incorrect syntax near ')'. Server: Msg 170, Level 15, State 1, Procedure sp_MSsync_ins_t2_1, Line 376 Line 376: Incorrect syntax near ')'.



WORKAROUND
To work around the problem, follow these steps:
 * 1) Call the sp_addarticle stored procedure with @vertical_partition = 'false' (this will include all the columns in the partition).
 * 2) For each column that must be removed from the partition, call the sp_articlecolumn stored procedure with @operation = 'drop', @refresh_synctran_procs = 1 (and all the necessary parameters).
 * 3) Call the sp_articleview stored procedure to create the synchronization object.

To work around the problemm make the following changes to the code mentioned in the More Information section: -- Adding the transactional articles exec sp_addarticle @publication = N'pubs1', @article = N't2', @source_owner = N'dbo', @source_object = N't2', @destination_table = N't2', @type = N'logbased', @creation_script = null, @description = null, @pre_creation_cmd = N'drop', @schema_option = 0x000000000000CEF3, @status = 16, @vertical_partition = N'false', @ins_cmd = N'CALL sp_MSins_t2', @del_cmd = N'XCALL sp_MSdel_t2', @upd_cmd = N'XCALL sp_MSupd_t2', @filter = null, @sync_object = null, @auto_identity_range = N'false' GO

---Dropping the columns that you do not need (col3, col4, col5, col6) sp_articlecolumn @publication='pubs1', @article='t2', @column='col3', @operation='drop', @refresh_synctran_procs =1, @change_active=1, @force_invalidate_snapshot =1, @force_reinit_subscription=1 go sp_articleview @publication='pubs1', @article='t2' go

sp_articlecolumn @publication='pubs1', @article='t2', @column='col4', @operation='drop', @refresh_synctran_procs =1, @change_active=1, @force_invalidate_snapshot =1, @force_reinit_subscription=1 go sp_articleview @publication='pubs1', @article='t2' go

sp_articlecolumn @publication='pubs1', @article='t2', @column='col5', @operation='drop', @refresh_synctran_procs =1, @change_active=1, @force_invalidate_snapshot =1, @force_reinit_subscription=1 go sp_articleview @publication='pubs1', @article='t2' go

sp_articlecolumn @publication='pubs1', @article='t2', @column='col6', @operation='drop', @refresh_synctran_procs =1, @change_active=1, @force_invalidate_snapshot =1, @force_reinit_subscription=1 go sp_articleview @publication='pubs1', @article='t2' go



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
The following code segment illustrates the problem:

use master go exec sp_replicationdboption @dbname = N'pubs1', @optname = N'publish', @value = N'false' GO

drop database pubs1 go create database pubs1 go

use [pubs1] GO

-- Only pkcol1, idcol2 have to go to the vertical partition CREATE TABLE [dbo].[t2] (       [pkcol1] [bigint] NOT NULL,        [idcol2] [bigint] IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL ,        [col3] char(2) NOT NULL,        [col4] char(2) NOT NULL,        [col5] char(2) NOT NULL,        [col6] char(2) NOT NULL        ) ON [PRIMARY] GO

ALTER TABLE [dbo].[t2] WITH NOCHECK ADD CONSTRAINT [PK_t2] PRIMARY KEY CLUSTERED (               [pkcol1]        ) WITH  FILLFACTOR = 90  ON [PRIMARY] GO

ALTER TABLE [dbo].[t2] WITH NOCHECK ADD CONSTRAINT [IX_t2] UNIQUE NONCLUSTERED (               [idcol2]        )   ON [PRIMARY] GO

-- Enabling the replication database use master GO exec sp_addsubscriber @@servername exec sp_replicationdboption @dbname = N'pubs1', @optname = N'publish', @value = N'true' GO

use [pubs1] GO

-- Adding the transactional publication exec sp_addpublication @publication = N'pubs1', @restricted = N'false', @sync_method = N'native', @repl_freq = N'continuous', @description = N'Transactional publication of pubs1 database', @status = N'active', @allow_push = N'true', @allow_pull = N'false', @allow_anonymous = N'false', @enabled_for_internet = N'false', @independent_agent = N'true', @immediate_sync = N'false', @allow_sync_tran = N'false', @autogen_sync_procs = N'true', @retention = 72, @allow_queued_tran = N'true', @snapshot_in_defaultfolder = N'true', @compress_snapshot = N'false', @ftp_port = 21, @ftp_login = N'anonymous', @allow_dts = N'false', @allow_subscription_copy = N'false' go exec sp_addpublication_snapshot @publication = N'pubs1',@frequency_type = 4, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 8, @frequency_subday_interval = 1, @active_start_date = 0, @active_end_date = 0, @active_start_time_of_day = 0, @active_end_time_of_day = 235959 GO

exec sp_grant_publication_access @publication = N'pubs1', @login = N'BUILTIN\Administrators' GO exec sp_grant_publication_access @publication = N'pubs1', @login = N'distributor_admin' GO exec sp_grant_publication_access @publication = N'pubs1', @login = N'sa' GO

-- Adding the transactional articles exec sp_addarticle @publication = N'pubs1', @article = N't2', @source_owner = N'dbo', @source_object = N't2', @destination_table = N't2', @type = N'logbased', @creation_script = null, @description = null, @pre_creation_cmd = N'drop', @schema_option = 0x000000000000CEF3, @status = 16, @vertical_partition = N'true', @ins_cmd = N'CALL sp_MSins_t2', @del_cmd = N'XCALL sp_MSdel_t2', @upd_cmd = N'XCALL sp_MSupd_t2', @filter = null, @sync_object = null, @auto_identity_range = N'false' GO

Additional query words:

Keywords: kbbug KB815122

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.