April 17, 2012

sp_copymergesnapshot (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_copymergesnapshot(nvarchar @publication
, nvarchar @destination_folder)

MetaData:

 create procedure sys.sp_copymergesnapshot (  
@publication sysname,
@destination_folder nvarchar(255)
)
AS
BEGIN
SET NOCOUNT ON
DECLARE @retcode int
DECLARE @source_folder nvarchar(255)
SELECT @retcode = 0

EXEC @retcode = dbo.sp_MSreplcheck_publish
IF @@ERROR <> 0 or @retcode <> 0
return (1)

CREATE TABLE #snapshot_folders
(
id int identity,
snapshot_folder nvarchar(255) collate database_default
)
IF @@ERROR <> 0
BEGIN
RETURN 1
END

INSERT INTO #snapshot_folders
EXEC @retcode = sys.sp_browsemergesnapshotfolder @publication = @publication
IF @retcode <> 0 OR @@ERROR <> 0
BEGIN
GOTO Failure
END

SELECT @source_folder = (select top 1 snapshot_folder FROM #snapshot_folders ORDER BY id ASC)
IF @@ERROR <> 0
BEGIN
GOTO Failure
END
SET ROWCOUNT 0

EXEC @retcode = sys.sp_MScopysnapshot @source_folder,
@destination_folder
IF @retcode <> 0 OR @@ERROR <> 0
BEGIN
GOTO Failure
END

DROP TABLE #snapshot_folders
RETURN 0
Failure:
SET ROWCOUNT 0
DROP TABLE #snapshot_folders
RETURN 1
END

No comments:

Post a Comment

Total Pageviews