May 8, 2012

sp_MScleanup_publication_ADinfo (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_MScleanup_publication_ADinfo(nvarchar @name
, nvarchar @database)

MetaData:

 create procedure sys.sp_MScleanup_publication_ADinfo   
@name sysname,
@database sysname
AS

SET NOCOUNT ON

declare @mergepublish_bit int
declare @tranpublish_bit int
declare @cmd nvarchar(640)

select @mergepublish_bit = 4
select @tranpublish_bit = 1

--
-- Security Check
--
select @cmd = quotename(@database) + '.sys.sp_MSreplcheck_publish'
exec @cmd
IF @@ERROR <> 0
return (1)

if (select category & @tranpublish_bit from master.dbo.sysdatabases where name = @database collate database_default) <> 0
begin
select @cmd = N'update' + quotename(@database) + N'.dbo.syspublications set ad_guidname=NULL where name=N' + quotename(@name, N'''')
exec (@cmd)
end

if (select category & @mergepublish_bit from master.dbo.sysdatabases where name = @database collate database_default) <> 0
begin
select @cmd = N'update' + quotename(@database) + N'.dbo.sysmergepublications set ad_guidname=NULL where name=N' + quotename(@name, N'''')
exec (@cmd)
end

No comments:

Post a Comment

Total Pageviews