Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSvupgrade_registry_core

  No additional text.


Syntax

-- Name: sp_MSvupgrade_registry_core

-- Descriptions: helper proc to loop through syncmgr subscription list in registry and move them to new one

-- Parameters: as defined in create statement

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

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

create procedure sys.sp_MSvupgrade_registry_core
	@oldregkeyroot                        nvarchar(1000)
	,@newregkeyroot                        nvarchar(1000)
as
    set nocount on
    declare @oldregkey nvarchar(1000)
    	,@newregkey                        nvarchar(1000)
    	,@subscription_name                nvarchar(1000)
    	,@retcode                        int
    	,@keyexist                         int

	set @retcode = 0
    insert into #keyexist EXECUTE master.dbo.xp_regread 'HKEY_LOCAL_MACHINE', @oldregkeyroot
    select @keyexist = keyexist from #keyexist

    if @keyexist = 1
    begin
        -- Move the registered subscriptions to new location in registry
        insert into #syncmgr_subscriptions EXECUTE master.dbo.xp_regenumkeys 'HKEY_LOCAL_MACHINE', @oldregkeyroot
        declare #subscriptioncursor CURSOR LOCAL FAST_FORWARD FOR
            select DISTINCT subscription_name
                    FROM #syncmgr_subscriptions    FOR READ ONLY

        open #subscriptioncursor
        fetch next from #subscriptioncursor into @subscription_name
        while (@@fetch_status <> -1)
        begin
			if (sys.fn_pubservernamefromsyncmgr(@subscription_name) = UPPER(@@servername))
			begin
				set @newregkey = @newregkeyroot + @subscription_name
				set @oldregkey = @oldregkeyroot + @subscription_name

				exec @retcode = sys.sp_MScopy_subscription_regkeys @oldregkey, @newregkey
				if @@error<>0 or @retcode<>0
				begin
				    set @retcode = 1
				    goto FAILURE
				end
			end
			fetch next from #subscriptioncursor into @subscription_name
        end

        close #subscriptioncursor
        deallocate #subscriptioncursor
    end

    truncate table #keyexist
    truncate table #syncmgr_subscriptions
FAILURE:
    return @retcode

 
Last revision
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