May 14, 2012

sp_MSenumthirdpartypublicationvendornames (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_MSenumthirdpartypublicationvendornames(bit @within_db)

MetaData:

   
create procedure sys.sp_MSenumthirdpartypublicationvendornames(
@within_db bit = 0
)

as
set nocount on
if @within_db = 0
begin
declare @dbname sysname
declare @retcode int
declare @distbit int
declare @proc nvarchar(300)

-- init
SELECT @distbit = 16

-- Get publication list
create table #pubdbs (publisher_db sysname collate database_default not null)

insert into #pubdbs select name from master.dbo.sysdatabases where
category & @distbit <> 0 and
has_dbaccess(name) = 1

create table #MSenumpublications
(vendor_name sysname collate database_default not null)

declare hCForEachDb CURSOR LOCAL FAST_FORWARD FOR select publisher_db from #pubdbs
FOR READ ONLY
open hCForEachDb
fetch hCForEachDb into @dbname
-- Loop for each database --
while (@@fetch_status >= 0)
begin
select @proc = quotename(@dbname) +
'.sys.sp_MSenumthirdpartypublicationvendornames'
insert into #MSenumpublications exec @retcode = @proc 1
if @@ERROR <> 0 or @retcode <> 0
return (1)
fetch hCForEachDb into @dbname
end -- while FETCH_SUCCESS --
end
else
begin
select distinct vendor_name from MSpublications where thirdparty_flag = 1 and
vendor_name is not null and vendor_name <> ''
end

select distinct vendor_name from #MSenumpublications order by vendor_name

return (0)

No comments:

Post a Comment

Total Pageviews