sql server 存储过程(事务,带参数声明,数据库瘦身)

CREATE PROCEDURE procedureName (@var1 as varchar(50),@var2 as varchar(50))
--建立未发临时表
AS
begin tran

--doSth

DUMP TRANSACTION GJJ WITH NO_LOG ---------1.清空日志

BACKUP LOG GJJ WITH NO_LOG ------------2.截断事务日志

DBCC SHRINKDATABASE(GJJ) ----------------- 3.收缩数据库



IF @@ERROR>0 
BEGIN
ROLLBACK
END
ELSE 
BEGIN
COMMIT
END

GO

  

posted @ 2014-05-06 15:54  木一木  阅读(795)  评论(0编辑  收藏  举报