Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_vupgrade_registry_custom_resolver_katmai

  No additional text.


Syntax

-- Name: sp_vupgrade_registry_custom_resolver_katmai

-- Descriptions:  this is called by sp_vupgrade_registry, to move custom resolver keys
--                     to the MSmerge_articleresolver table on the distributor

-- Parameters: as defined in create statement

-- Returns: 0 - success
--          1 - Otherwise

-- Security:
-- Requires Certificate signature for catalog access

create procedure sys.sp_vupgrade_registry_custom_resolver_katmai
(
    @oldregkey  nvarchar(1000)
)
as
    set nocount on
    declare @distributor                        sysname
    declare @distribution_db                sysname
    declare @resolver_name                    nvarchar(1000)
    declare @resolver_clsid                    nvarchar(1000)
    declare @insertproc                                     nvarchar(547)
    declare @retcode                        int
    declare @keyexist                         int

    EXEC @retcode = sys.sp_helpdistributor @rpcsrvname = @distributor OUTPUT, @distribdb = @distribution_db OUTPUT
    IF @@error <> 0 OR @retcode <> 0
    BEGIN
        RAISERROR (20036, 16, -1)
        RETURN (1)
    END

    -- if the server is not a distributor we do not need to do anything
    if @distributor IS NULL
        return 0

    create table #keyexist (keyexist int)

    -- Move the registered article resolvers to MSmerge_articleresolver on distribution db
    insert into #keyexist EXECUTE master.dbo.xp_regread 'HKEY_LOCAL_MACHINE', @oldregkey
    select @keyexist = keyexist from #keyexist
    if @keyexist = 1
    begin
        create table #article_resolvers (resolver_name nvarchar(1000) collate database_default, resolver_clsid nvarchar(1000))
        insert into #article_resolvers EXECUTE master.dbo.xp_regenumvalues 'HKEY_LOCAL_MACHINE', @oldregkey
        declare #resolvercursor CURSOR LOCAL FAST_FORWARD FOR
            select DISTINCT resolver_name, resolver_clsid
                    FROM #article_resolvers
                FOR READ ONLY

        open #resolvercursor
        fetch next from #resolvercursor into @resolver_name, @resolver_clsid
        while (@@fetch_status <> -1)
        begin
            select @insertproc = QUOTENAME(RTRIM(@distributor)) + N'.' + QUOTENAME(RTRIM(@distribution_db)) + '.sys.sp_registercustomresolver'

            exec @retcode = @insertproc
                    @article_resolver = @resolver_name,
                    @resolver_clsid = @resolver_clsid

            if @retcode <> 0 OR @@ERROR <> 0
            begin
                set @retcode = 1
                goto FAILURE
            end
            fetch next from #resolvercursor into @resolver_name, @resolver_clsid
        end

        -- done moving reg keys/values.  delete old key
        exec @retcode = master.dbo.xp_regdeletekey 'HKEY_LOCAL_MACHINE', @oldregkey
        if @@error <> 0 OR @retcode <> 0
        begin
            set @retcode = 1
        end

        close #resolvercursor
        deallocate #resolvercursor
        drop table #article_resolvers

        return 0

    end

FAILURE:
    drop table #keyexist
    return @retcode


 
Last revision 2008RTM
See also

  sp_vupgrade_registry (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash