May 2, 2012

sp_markpendingschemachange (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_markpendingschemachange(nvarchar @publication
, int @schemaversion
, nvarchar @status)

MetaData:

 create procedure sys.sp_markpendingschemachange(  
@publication sysname,
@schemaversion int = 0,
@status nvarchar(10) = 'active' -- active, skipped --
)
as
begin
set nocount on
declare @retcode int
declare @pubid uniqueidentifier
declare @compatlevel int
declare @statusid int
declare @SCHEMA_TYPE_SNAPSHOTTRAILER int

select @retcode = 0
exec @retcode=sys.sp_MSreplcheck_publish
if @retcode<>0 or @@ERROR<>0 return (1)

if @publication IS NULL
begin
raiserror (14003, 16, -1)
return (1)
end

select @pubid = pubid, @compatlevel = backward_comp_level FROM dbo.sysmergepublications WHERE name = @publication and UPPER(publisher)=UPPER(publishingservername()) and publisher_db=db_name()
if @pubid is NULL
begin
raiserror (21274, 16, -1, @publication)
return (1)
end

if @compatlevel < 90
begin
raiserror(22557, 16, -1, @publication)
return 1
end

select @status = lower(@status collate SQL_Latin1_General_CP1_CS_AS)
if @status not in ('active', 'skipped')
begin
RAISERROR(22559 , 16, -1)
return (1)
end

if @status = N'active'
select @statusid = 1
else if @status = N'skipped'
select @statusid = 2

update dbo.sysmergeschemachange set schemastatus = @statusid
where pubid=@pubid and schemaversion = @schemaversion
if @@error <> 0 or @@rowcount <> 1
begin
RAISERROR(22558 , 16, -1)
return (1)
end
return (0)
end

No comments:

Post a Comment

Total Pageviews