我正在尝试调用sp_rename
内部事务 ( BEGIN TRANSACTION
),但它显示此错误消息:
Can't run sp_rename from within a transaction., Error 17260, Procedure sp_rename, Line 78
sp_rename
代码检查任何未结交易::
/*
** Running sp_rename inside a transaction would endanger the
** recoverability of the transaction/database. Disallow it.
** Do the @@trancount check before initializing any local variables,
** because "select" statement itself will start a transaction
** if chained mode is on.
*/
if @@trancount > 0
begin
/*
** 17260, "Can't run %1! from within a transaction."
*/
raiserror 17260, "sp_rename"
return (1)
end
else
begin
set chained off
end
我不明白为什么这些行为是危险的......
此外,我需要一种在事务中调用此存储过程然后回滚此操作的方法。
有什么建议么?