Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_vupgrade_subpass

  No additional text.


Syntax
create procedure sys.sp_vupgrade_subpass
as
begin
    set nocount on

    begin transaction
    save tran sp_vupgrade_subpass

    /*
     * MSsubscription_properties
    */
    if object_id('MSsubscription_properties') is not NULL
    begin
        if not exists (select * from sys.columns where object_id = Object_Id('MSsubscription_properties') and name = 'ftp_password' and max_length = '1048')
        begin
            declare @cmptlevel tinyint
            select @cmptlevel = cmptlevel from master.dbo.sysdatabases where dbid = db_id()
            if @cmptlevel < 70
            begin
                raiserror (15048, 10, 1, 70, 70, 70, 80)
            end
            else
            begin
                /*
                * alter ftp_password column from sysname to nvarchar(524)
                */
                exec( N'alter table MSsubscription_properties alter column ftp_password nvarchar(524)' )
                exec( N'alter table MSsubscription_properties alter column distributor_password nvarchar(524)' )
                exec( N'alter table MSsubscription_properties alter column publisher_password nvarchar(524)' )
                exec( N'alter table MSsubscription_properties alter column dts_package_password nvarchar(524)' )
            end
        end

        /*
         * convert all the ftp_passwords to new encryption
         */
        declare @ftp_password nvarchar(524)
        declare @distributor_password nvarchar(524)
        declare @publisher_password nvarchar(524)
        declare @dts_package_password nvarchar(524)
        declare @retcode int

        declare #cur_MSsubscription_properties CURSOR LOCAL FORWARD_ONLY for
        select ftp_password, distributor_password, publisher_password, dts_package_password
        from MSsubscription_properties
        for update of ftp_password, distributor_password, publisher_password, dts_package_password

        open #cur_MSsubscription_properties
        fetch #cur_MSsubscription_properties into @ftp_password, @distributor_password, @publisher_password, @dts_package_password
        while ( @@fetch_status <> -1 )
        begin
            -- if we have sphinx/shiloh encryption go ahead and convert
            if sys.fn_replencryptversion(@ftp_password) in (1, 2, 3)
            begin
                EXEC @retcode = sys.xp_repl_convert_encrypt @ftp_password OUTPUT
                IF @@error <> 0 OR @retcode <> 0
                    goto error
            end

            -- if we have sphinx/shiloh encryption go ahead and convert
            if sys.fn_replencryptversion(@distributor_password) in (1, 2, 3)
            begin
                EXEC @retcode = sys.xp_repl_convert_encrypt @distributor_password OUTPUT
                IF @@error <> 0 OR @retcode <> 0
                    goto error
            end

            -- if we have sphinx/shiloh encryption go ahead and convert
            if sys.fn_replencryptversion(@publisher_password) in (1, 2, 3)
            begin
                EXEC @retcode = sys.xp_repl_convert_encrypt @publisher_password OUTPUT
                IF @@error <> 0 OR @retcode <> 0
                    goto error
            end

            -- if we have sphinx/shiloh encryption go ahead and convert
            if sys.fn_replencryptversion(@dts_package_password) in (1, 2, 3)
            begin
                EXEC @retcode = sys.xp_repl_convert_encrypt @dts_package_password OUTPUT
                IF @@error <> 0 OR @retcode <> 0
                    goto error
            end

            update MSsubscription_properties
            set ftp_password=@ftp_password, distributor_password=@distributor_password, publisher_password=@publisher_password, dts_package_password=@dts_package_password
            where current of #cur_MSsubscription_properties

            fetch #cur_MSsubscription_properties into @ftp_password, @distributor_password, @publisher_password, @dts_package_password
        end -- while ( @@fetch_status <> -1 )
        close #cur_MSsubscription_properties
        deallocate #cur_MSsubscription_properties
    end -- if object_id('MSsubscription_properties')

    commit transaction
    return 0

error:
    rollback tran sp_vupgrade_subpass
    commit tran
    return 1
end

 
Last revision 2008RTM
See also

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