Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_vupgrade_subscription_databases

  No additional text.


Syntax
create procedure sys.sp_vupgrade_subscription_databases
as
begin
    set nocount on

    -- raiserror('sp_vupgrade_subscription_databases', 0,1) with nowait
    declare @dbname nvarchar(270),
            @has_dbaccess bit,
            @dbupgprocname nvarchar(1024)

    -- Upgrade all databases except system and distribution db's
    -- These db's cannot be subscription databases
    DECLARE current_db CURSOR LOCAL FAST_FORWARD
    FOR
    SELECT  distinct N'[' + replace(name, N']', N']]') + N']',
            has_dbaccess(name)
    FROM    master.dbo.sysdatabases
    WHERE   name NOT IN
                (
                    N'master' COLLATE DATABASE_DEFAULT,
                    N'tempdb' COLLATE DATABASE_DEFAULT,
                    N'msdb'   COLLATE DATABASE_DEFAULT,
                    N'model'   COLLATE DATABASE_DEFAULT
                )
    AND   sys.fn_MSrepl_isdistdb (name) = 0
    and databasepropertyex(name, 'Updateability') = 'READ_WRITE'
    FOR READ ONLY

    -- Note: dbname is quoted!
    open current_db
    fetch current_db into @dbname, @has_dbaccess
    while ( @@fetch_status <> -1 )
    begin

        -- upgrade repl tables in sub dbs if needed - sub dbs are not marked with subscribed status
        -- skip any database in an offline state and write warning to upgrade log
        if ( @has_dbaccess = 1 )
        begin
            raiserror( 21377, 0, 1, @dbname) with nowait

            select @dbupgprocname = @dbname + N'.sys.sp_vupgrade_MSsubscription_properties'
            exec @dbupgprocname
            select @dbupgprocname = @dbname + N'.sys.sp_vupgrade_subscription_tables'
            exec @dbupgprocname
            select @dbupgprocname = @dbname + N'.sys.sp_vupgrade_mergetables'
            exec @dbupgprocname
            select @dbupgprocname = @dbname + N'.sys.sp_vupgrade_subpass'
            exec @dbupgprocname

            -- ONLY DO THIS IF WE KNOW MSDB IS UPGRADED
            IF EXISTS(SELECT *
                        FROM msdb.sys.columns
                        WHERE object_id = OBJECT_ID(N'msdb.dbo.sysjobsteps')
                            AND name = N'step_uid')
            BEGIN
                select @dbupgprocname = @dbname + N'.sys.sp_MSupgrade_subdb_security_metadata'
                exec @dbupgprocname
            END
            ELSE
            BEGIN
                -- "The replication %s could not be upgraded for %s database(s). Please ensure that %s is upgraded and re-execute %s."
                RAISERROR(21450, 10, -1, 'subscriber security meta-data', @dbname,  'msdb database', 'sp_vupgrade_replsecurity_metadata') WITH NOWAIT
            END
        end
        else
        begin
            raiserror( 21373, 10, 1, @dbname) with nowait
        end

        fetch next from current_db into @dbname, @has_dbaccess
    end
    close current_db
    deallocate current_db
end

 
Last revision 2008RTM
See also

  sp_refreshreplsysservers (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