日期:2014-05-18  浏览次数:20465 次

【寻求一个触发器】用于删除某个表数据前的数据库备份
想请各位高手帮忙写一个触发器。
需求:删除一个表A中的数据之前,对表A所在的数据库进行全备份

------解决方案--------------------
create trigger backup_delete on 表A
for delete
as

select * into back_delete from deleted
------解决方案--------------------

create trigger backup_delete on 表A
for delete
as

if exists (select * from dbo.sysobjects where id = object_id(N '[dbo].[back_delete] ') and OBJECTPROPERTY(id, N 'IsUserTable ') = 1)
drop table [dbo].[back_delete]
GO

select * into back_delete from deleted
------解决方案--------------------
不能在事务内部执行备份或还原操作
------解决方案--------------------
Hope this helpful.
http://community.csdn.net/Expert/topic/5146/5146269.xml?temp=.5785791
------解决方案--------------------
需求很不合理