cpder 发表于 2012-8-31 16:54:03

未能找到存储过程‘dbo.sp_MScleandbobjectsforreplication’

T3财务通普及版,MSDE升级到SQL2000,在恢复账套的时候,出现以下提示:





处理办法:打开数据库的企业管理器,打开master数据库,点“存储过程”,点右键新建存储过程,文本里面写入:
create procedure sp_MScleandbobjectsforreplication
as
begin
    set nocount on
    declare @tabid int
          ,@colname sysname
          ,@publish smallint      /* Constant: 0x1000 */
          ,@nonsqlsub smallint      /* Constant: 0x2000 */
      ,@initiated smallint      /* Constant: 0x4000 */
      ,@repldts smallint      /* Constant: 0x8000 */
      ,@publish_bit smallint
      ,@replicate_bit smallint
      ,@filter smallint
      ,@schema_replicated smallint
      ,@procexec smallint
      ,@db_tranbit smallint

    SELECT @publish = 0x1000
          ,@nonsqlsub = 0x2000
      ,@repldts = 0x8000
      ,@publish_bit = 1
          ,@replicate_bit = 2
          ,@filter = 32
          ,@procexec = 24
          ,@schema_replicated = 0x00000200
          ,@db_tranbit = 1

--if database is in read-only mode, don't try to cleanup anything
if databasepropertyex(db_name(), 'Updateability') = 'READ_ONLY'
    return (0)

begin tran
save tran sp_MScleandb
--
--these two conditions are required for us to get here, but double check again just to make sure
--
IF NOT EXISTS (SELECT * FROM master..sysdatabases
    WHERE name = db_name() collate database_default AND (category & @db_tranbit) = @db_tranbit)
    and NOT EXISTS (select * from sysobjects where name = 'syspublications' )
begin
      --
      -- cleanup the objects in the database if they are not in clean state (replication metadata is marked)
      -- check columns
      --
    update syscolumns set colstat = colstat & ~(@publish| @nonsqlsub | @repldts)
          where colstat & (@publish| @nonsqlsub | @repldts) > 0
    if (@@error <> 0)
      goto FAILURE
      --
      --check tables/views/proc/fns and proc exec
      --
      UPDATE sysobjects SET replinfo = replinfo & ~ (@publish_bit | @replicate_bit | @filter | @schema_replicated | @procexec)
            where replinfo &(@publish_bit | @replicate_bit | @filter | @schema_replicated | @procexec)> 0
    if (@@error <> 0)
      goto FAILURE
      --
      -- all done
      --
    end
    if @@trancount > 0
      commit tran
    return 0
FAILURE:
if @@trancount > 0
begin
    rollback tran sp_MScleandb
    commit tran
end
return 1

end

GO
点“确定”。

页: [1]
查看完整版本: 未能找到存储过程‘dbo.sp_MScleandbobjectsforreplication’