对等复制增加article


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Repl_AddArticlePeer]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[Repl_AddArticlePeer]
GO

/*对等复制增加Article
 EXEC Repl_AddArticlePeer 'testrepl'
*/

CREATE PROCEDURE Repl_AddArticlePeer
@article AS sysname
AS 
BEGIN 
	IF ISNULL(@article,'') = ''
	BEGIN
		RETURN
	END  

	DECLARE @publication AS sysname;  
	SET @publication =DB_NAME(); 

	DECLARE
        @ins_cmd	nvarchar (255),
        @del_cmd	nvarchar (255),
        @upd_cmd	nvarchar (255) 

	SET @ins_cmd = 'CALL sp_MS' + 'ins' + '_dbo' + @article
	SET @del_cmd = 'CALL sp_MS' + 'del' + '_dbo' + @article
	SET @upd_cmd = 'CALL sp_MS' + 'upd' + '_dbo' + @article

	EXEC sp_addarticle @publication = @publication, @article = @article, @source_owner = N'dbo', 
	@source_object =@article, @type = N'logbased', @description = null,@creation_script = null,
	@pre_creation_cmd = N'drop', @schema_option = 0x0000000008035DDB, @force_invalidate_snapshot = 1, @identityrangemanagementoption = N'manual', 
	@destination_table = @article, @status = 16,@vertical_partition = N'false', @ins_cmd = @ins_cmd, @del_cmd = @del_cmd, @upd_cmd = @upd_cmd
END