SQL 事务
------------------------------------------------------------------------- --SQL事务 BEGIN TRANSACTION declare @MaxDelete int = 0 ; --最大可删除的行数 ------------------------------------------------------------------------- --执行的SQL语句 DELETE TableName Where FieldName = '' ------------------------------------------------------------------------- --判断影响的行数,超过限定就回滚 if (@@rowcount > @MaxDelete ) begin print '删除行数过多,已经回滚' rollback transaction end else begin print '操作成功' commit transaction end -------------------------------------------------------------------------