create procedure sys.sp_MScreate_replication_status_table
as
declare @retcode int
if (select object_id('tempdb.dbo.MSreplication_agent_status')) is NULL
begin
-- begin tran
create table tempdb.dbo.MSreplication_agent_status (
publisher sysname NOT NULL,
publisher_db sysname NOT NULL,
publication sysname NOT NULL,
publication_type int NOT NULL, -- 0 transactional/snapshot 1 Merge
agent_type int NOT NULL,
status int NOT NULL,
agent_name nvarchar(100) NOT NULL,
timestamp NOT NULL
)
if @@error <> 0
return 1
create clustered index cMSreplication_agent_status ON tempdb.dbo.MSreplication_agent_status (agent_name)
if @@error <> 0
return 1
create nonclustered index unc1MSreplication_agent_status ON
tempdb.dbo.MSreplication_agent_status (publication, publisher_db, publisher)
if @@error <> 0
return 1
create nonclustered index unc2MSreplication_agent_status ON
tempdb.dbo.MSreplication_agent_status (agent_type)
if @@error <> 0
return 1
create nonclustered index unc3MSreplication_agent_status ON
tempdb.dbo.MSreplication_agent_status (timestamp)
if @@error <> 0
return 1
exec @retcode = tempdb.dbo.sp_MS_marksystemobject 'dbo.MSreplication_agent_status'
if @@error <> 0 or @retcode <> 0
return 1
end
return 0 -- If here, all is well and we're done.