Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_refreshreplsysservers

  No additional text.


Syntax
create procedure sys.sp_refreshreplsysservers
@mode tinyint = 0 --0 called by sp_replicationdboption, 1 called by upgrade/restore
as
begin
	set nocount on
	declare @dbname sysname
				,@refresh_publish tinyint
				,@refresh_upgrade tinyint
	
	select @refresh_publish = 0
				,@refresh_upgrade = 1
				,@dbname = DB_NAME()

	if (DatabasePropertyEx(@dbname, 'IsPublished') = 1)
		or (DatabasePropertyEx(@dbname, 'IsMergePublished') = 1)
	begin
    	if not exists (select * from sys.tables where name = 'sysreplservers')
    	begin
    		create table sysreplservers (srvname sysname primary key clustered, srvid int)
			exec dbo.sp_MS_marksystemobject 'sysreplservers'
		end
		--if table already has an entry, merge may have called and set it already
   		if not exists (select * from sysreplservers where srvname = UPPER(@@servername))
   		begin
			--don't allow it to setup merge and tran in two different originating source, since we only have on global publishingservername()
	   		if exists (select * from sysreplservers where srvname <> UPPER(@@servername))
	   			and @mode = @refresh_publish
	   		begin
					RAISERROR (22580, 10, -1, @dbname)
					return (1)
			end
			--upgrade of mirror instance my get here with an entry pointing to principle already, leave it be
	   		if not exists (select * from sysreplservers)
	   		begin
				if exists (select * from master.dbo.sysdatabases where dbid = db_id() and cmptlevel > 70)
					exec(N'insert sysreplservers (srvname, srvid) select UPPER(srvname collate database_default ), srvid from master.dbo.sysservers where UPPER(srvname collate database_default ) = UPPER(@@servername)')
				else
					exec(N'insert sysreplservers (srvname, srvid) select UPPER(srvname), srvid from master.dbo.sysservers where UPPER(srvname) = UPPER(@@servername)')
			end
		end
	end
	else
	begin
    	if exists (select * from sys.tables where name = 'sysreplservers')
    	begin
    		drop table sysreplservers
    	end
	end
	return 0
end

-- Name: sp_vupgrade_mergetables

-- Descriptions:

-- Process schema and metadata changes common to transactional pub/sub databases.

-- @remove_repl is set by sp_restoredbreplication when calling this proc directly to update
-- system tables during restore of a down-level (e.g. - SQL7.0) database to current version

-- Setup version upgrade procedure call order:
--    sp_vupgrade_replication -> sp_vupgrade_subscription_databases -> sp_vupgrade_mergetables

-- Parameters: as defined in create statement

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

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

raiserror('Creating procedure sp_vupgrade_mergetables', 0,1)

 
Last revision SQL2008SP2
See also

  sp_MSremovedbreplication_internal (Procedure)
sp_MSrestoredbreplication (Procedure)
sp_removesrvreplication (Procedure)
sp_replicationdboption (Procedure)
sp_vupgrade_publisher (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