Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_vupgrade_registry

  No additional text.


Syntax

-- Name: sp_vupgrade_registry

-- Descriptions:

-- Parameters: as defined in create statement

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

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

create procedure sys.sp_vupgrade_registry
as
    set nocount on
    declare @regkey                                nvarchar(1000)
    declare @retcode                               int
    declare @dbname                               sysname
    declare @has_dbaccess                      bit
    declare @instance_name                     sysname
    declare @instance_id                          sysname

    -- During the setup config object codepath, the old resolvers will have been copied to
    -- a temporary key inside the instance hive. We need to put these values into the database and then delete the registry key.
    -- The config object should delete the old key if this is the last instance on the box

    -- get the instance name
    select @instance_name =  convert(sysname, SERVERPROPERTY(N'InstanceName'))
    if @instance_name is null
        select @instance_name  =  N'MSSQLSERVER'

    -- map instance name to instance id via the registry
    select @regkey = N'SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL'
    exec @retcode = master.dbo.xp_regread N'HKEY_LOCAL_MACHINE',
        @regkey,
        @instance_name,
        @param = @instance_id OUTPUT,
        @no_output = N'no_output'

    if @retcode <> 0 or @@ERROR <> 0
    begin
        return 1
    end

    -- do the copying
    set @regkey = N'SOFTWARE\Microsoft\Microsoft SQL Server\' + @instance_id + N'\Replication\ArticleResolver'
    raiserror(N'Attempting to copy article resolvers from %s', 10, 1, @regkey)
    exec @retcode = sys.sp_vupgrade_registry_custom_resolver_katmai @regkey
    if @@error <> 0 OR @retcode <> 0
        return 1

    -- Registering the default resolvers here will make sure that the clsids get upgraded.
    -- we need to register the resolvers for all distribution databases known on this machine
    declare @db_distbit int -- distribution db bit
    select @db_distbit = 16

    declare #cur_distdb CURSOR LOCAL FAST_FORWARD for
        select name, has_dbaccess(name) from master.dbo.sysdatabases
        where category & @db_distbit = @db_distbit
        and databasepropertyex(name, 'Updateability') = 'READ_WRITE'
        for read only

    open #cur_distdb
    fetch #cur_distdb into @dbname, @has_dbaccess
    while ( @@fetch_status <> -1 )
    begin
        -- Verify that this SKU is allowed to be a distributor
        exec @retcode= sys.sp_MSsku_allows_replication
	if @@error =0 and  @retcode = 0 and @has_dbaccess = 1
	begin
            exec @retcode = sys.sp_MSrepl_register_default_resolvers @dbname
            if @@error <> 0 OR @retcode <> 0
                return 1
        end

       fetch next from #cur_distdb into @dbname, @has_dbaccess
    end --while
    close #cur_distdb
    deallocate #cur_distdb

    return 0

 
Last revision 2008RTM
See also

  sp_vupgrade_registry_custom_resolver_katmai (Procedure)
sp_vupgrade_replication (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