只有系统管理员可以为RAISERROR命令指定WITH LOG选项。 [英] Only System Administrator can specify WITH LOG option for RAISERROR command.

查看:647
本文介绍了只有系统管理员可以为RAISERROR命令指定WITH LOG选项。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计,



我正在将SQL方案从SQL内部迁移到SQL Azure。收到错误说



只有系统管理员可以为RAISERROR命令指定WITH LOG选项。

代码块是

RAISERROR('move_profile_email存储过程失败。批量密钥%s,错误消息:%s',1,1,@ CurrentDateStr,@ ErrMsg)带日志



是否有任何条款可以在SQL Azure中使用使用LOG



我尝试以下面的方式向用户授予权限但是没有运气

EXEC sp_addrolemember'dbmanager ','< username>';

EXEC sp_addrolemember'loginmanager','< username>';



需要帮助.. 。

解决方案

不知道你是否已经尝试过这个,但如果你查看MSDN RAISERROR(Transact-SQL) [ ^ ]您可以在严重性的参数部分中阅读以下内容

引用:

任何用户都可以指定从0到18的严重级别。从19到25的严重级别只能由sysadmin固定服务器角色的成员或具有ALTER TRACE权限的用户指定。对于从19到25的严重性级别,需要WITH LOG选项。小于0的严重级别被解释为0.大于25的严重级别被解释为25。





所以给予ALTER TRACE权限应该这样做。


Hi Folks,

I am migrating DB scheme from SQL on-premise to SQL Azure. Getting an error saying

Only System Administrator can specify WITH LOG option for RAISERROR command.
Code Block is
RAISERROR('move_profile_email stored proc failed. Batch Key %s, Error Message: %s',1,1, @CurrentDateStr, @ErrMsg) WITH LOG

Is there any provision that wen Can use With LOG in SQL Azure.

I tried giving permissions to the user in below way but no luck,.
EXEC sp_addrolemember 'dbmanager', '<username>';
EXEC sp_addrolemember 'loginmanager', '<username>';

Help needed...

解决方案

Don't know if you have tried this already, but if you look in MSDN RAISERROR (Transact-SQL)[^] you can read the following in the arguments section for severity

Quote:

Severity levels from 0 through 18 can be specified by any user. Severity levels from 19 through 25 can only be specified by members of the sysadmin fixed server role or users with ALTER TRACE permissions. For severity levels from 19 through 25, the WITH LOG option is required. Severity levels less than 0 are interpreted as 0. Severity levels greater than 25 are interpreted as 25.



So giving ALTER TRACE permission should do it.


这篇关于只有系统管理员可以为RAISERROR命令指定WITH LOG选项。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆