create procedure sys.sp_replsetoriginator (
@originator_srv sysname,
@originator_db sysname,
@publication sysname = NULL
)
as
declare @retcode int
/*
** Security Check, if @publication is supplied, check for PAL, otherwise DBO
*/
if @publication is not null
begin
exec @retcode = sys.sp_MSreplcheck_pull @publication = @publication
if @@error <> 0 or @retcode <> 0
begin
return (1)
end
end
else
begin
exec @retcode = sys.sp_MSreplcheck_subscribe
if @@ERROR <> 0 or @retcode <> 0
begin
return(1)
end
end
exec @retcode = sys.sp_replsetoriginator_internal @originator_srv, @originator_db
if @@ERROR <> 0 or @retcode <> 0
begin
return(1)
end
return 0