May 2, 2012

sp_lookupcustomresolver (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_lookupcustomresolver(nvarchar @article_resolver
, nvarchar @publisher)

MetaData:

 --   
-- Name: sp_lookupcustomresolver
--
-- Descriptions:
--
-- Parameters: as defined in create statement
--
-- Returns: 0 - success
-- 1 - Otherwise
--
-- Security:
-- Requires Certificate signature for catalog access
--

create procedure sys.sp_lookupcustomresolver
@article_resolver nvarchar(255),
@resolver_clsid nvarchar(50) OUTPUT,
@is_dotnet_assembly bit = 0 OUTPUT, -- This flag is set to TRUE while registering a .NET Framework Assembly
@dotnet_assembly_name nvarchar(255) = NULL OUTPUT, -- For .NET Framework Assemblies, this parameter must be set to the name of the .NET assembly that implements the BusinessLogicModule class
@dotnet_class_name nvarchar(255) = NULL OUTPUT, -- For .NET Framework Assemblies, this parameter must be set to the name of the .NET class that implements the BusinessLogicModule class
@publisher sysname = NULL
AS

declare @distributor sysname
declare @distributiondb sysname
declare @distproc nvarchar(1000)
declare @retcode int
declare @stmt nvarchar(1000)

set @retcode = 0

-- Security check
if 1 <> is_member('db_owner')
begin
RAISERROR (15247, 11, -1)
return (1)
end

if @article_resolver IS NULL or @article_resolver = ''
begin
RAISERROR (21717, 16, -1)
return 1
end

select @is_dotnet_assembly = 0

if @publisher is null
select @publisher = publishingservername()

--
-- Get the distributor
--
if ((@distributor is null) or (@distributiondb is null))
begin
EXEC @retcode = sys.sp_helpdistributor @rpcsrvname=@distributor OUTPUT,
@distribdb = @distributiondb OUTPUT,
@publisher = @publisher
IF @@error <> 0 or @retcode <> 0 or @distributiondb is NULL
BEGIN
RAISERROR (20036, 16, -1)
RETURN (1)
END
end

--
-- For a local distributor, query the MSmerge_articleresolver directly
--
if @distributor = @@servername and db_name() = @distributiondb
begin
select @resolver_clsid = resolver_clsid,
@is_dotnet_assembly = is_dotnet_assembly,
@dotnet_assembly_name = dotnet_assembly_name,
@dotnet_class_name = dotnet_class_name
from dbo.MSmerge_articleresolver
where article_resolver = @article_resolver

end
--
-- Since a downlevel publisher can connect to a remote distributor with a higher
-- version, it is better to return the resolver list using the RPC as opposed
-- to reading regkeys directly since they might change from version to version.
--
else
begin
select @distproc = quotename(RTRIM(@distributor)) + '.' + quotename(@distributiondb) +'.sys.sp_lookupcustomresolver'
exec @distproc
@article_resolver = @article_resolver,
@resolver_clsid = @resolver_clsid OUTPUT,
@is_dotnet_assembly = @is_dotnet_assembly OUTPUT,
@dotnet_assembly_name = @dotnet_assembly_name OUTPUT,
@dotnet_class_name = @dotnet_class_name OUTPUT,
@publisher = @publisher
if @@ERROR<> 0
return (1)
end

return @retcode

No comments:

Post a Comment

Total Pageviews