April 27, 2012

sp_helppublication (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_helppublication(nvarchar @publication
, nvarchar @publisher)

MetaData:

   
--
-- Name:
-- sp_helppublication
--
-- Description:
-- Returns information about a publication. If the article
-- name is not specified, it returns information for all publications
-- associated with the publishing database.
--
-- For a SQL Server publication, this stored procedure is executed
-- at the Publisher on the publishing database. For a heterogeneous
-- publication, this stored procedure may be executed in any database
-- at the distributor for the associated publisher.
--
-- When the @publication parameter is NULL, results are only returned
-- for those publications that the current user has PAL access to.
--
-- Security:
-- SQL Server publication: 'sysadmin', db_owner of publishing database, PAL
-- Heterogeneous publication: 'sysadmin', db_owner of distribution database, PAL
--
-- Returns:
-- Result set of publication properties
--
-- Owner:
-- <current owner>
--

create procedure sys.sp_helppublication
(
@publication sysname = N'%',
@found int = 23456 OUTPUT, -- flag indicate returning row
@publisher sysname = NULL
)
AS
BEGIN
SET NOCOUNT ON
DECLARE @cmd nvarchar(4000)
,@retcode int
,@publisher_type sysname

EXEC @retcode = sys.sp_MSrepl_getpublisherinfo
@publisher = @publisher,
@publisher_type = @publisher_type OUTPUT,
@rpcheader = @cmd OUTPUT,
@skipSecurityCheck = 1
IF @retcode <> 0
RETURN (@retcode)

SELECT @publisher = UPPER(@publisher)
,@cmd = case when (@publisher_type = N'MSSQLSERVER')
then @cmd + N'sys.sp_MSrepl_helppublication'
else @cmd + N'sys.sp_IHhelppublication' end
EXEC @retcode = @cmd
@publication,
@found OUTPUT,
@publisher,
@publisher_type
RETURN (@retcode)
END

No comments:

Post a Comment

Total Pageviews