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

9/1/2015来源:SQL技巧人气:1495

sql server 存储过程(事务,带参数声明,数据库瘦身)
CREATE PROCEDURE procedureName (@var1 as varchar(50),@var2 as varchar(50))--建立未发临时表ASbegin tran--doSthDUMP TRANSACTION GJJ WITH NO_LOG ---------1.清空日志BACKUP LOG GJJ WITH NO_LOG ------------2.截断事务日志DBCC SHRINKDATABASE(GJJ) ----------------- 3.收缩数据库IF @@ERROR>0 BEGINROLLBACKENDELSE BEGINCOMMITENDGO