用触发期,效果更好
CRETAE TRIGGER TR_NAME_DEL ON chat_record
FOR DELETE
INSERT INTO record_history
SELECT * FROM DELETED

解决方案 »

  1.   

    BEGIN TRAN  select * into #test  from  chat_record
     IF @@ERROR <> O GOTO QUITERROR
      insert into chat_record_history select *  from #test
     IF @@ERROR <> O GOTO QUITERROR
      delete chat_record where exists (select content from #test where chat_record.content=#test.content)
     IF @@ERROR <> O GOTO QUITERROR
      COMMIT
     GOTO SAVEEND
     QUITERROR:
      ROLLBACK
     SAVEEND:
      

  2.   

    是不是数据已被删除了,试试这个工具恢复数据吧.
    Log Explorerhttp://download.heibai.net/download/show.php?id=3125
    解压缩密码 www.heibai.net注册机产生的是注册码,是两个用解压缩密码解开后,压缩包里也有一个注册机的
      

  3.   

    DECLARE @select_error int, @insert_error int,@delete_error intBEGIN TRAN
     select * into #test  from  chat_record
     select @select_error = @@ERROR insert into chat_record_history select *  from #test
     select @insert_error=@@ERROR delete chat_record where exists (select content from #test where  chat_record.content=#test.content)
     select @delete_error=@@ERRORIF @select_error = 0 AND @insert_error = 0 AND @delete_error=0
    BEGIN
          COMMIT TRAN
    END
    ELSE
    BEGIN
       IF @select_error <> 0 
          PRINT "select error"    IF @inser_error <> 0
          PRINT "isnert error"    IF @delte_error <> 0
          PRINT "delete error" 
       ROLLBACK TRAN
    END
      

  4.   

    try:
    begin transtraction
     select * into #test  from  chat_record
     insert into chat_record_history select *  from #test
     if @@error<>0
      rollback transaction
      delete chat_record where exists (select content from #test where chat_record.content=#test.content)
    commit transtraction
      

  5.   

    执行insert into chat_record_history select *  from #test有什么出错提示么