如何调试sql server查询

时间:2022-04-12 23:39:16

I am trying to test some query so i tried running it inside of SQL enterprise manager and i get the following error:

我试图测试一些查询,所以我尝试在SQL企业管理器中运行它,我得到以下错误:

EXECUTE permission denied on object 'sp_enable_sql_debug', database 'mssqlsystemresource', schema 'sys'.

对象'sp_enable_sql_debug',数据库'mssqlsystemresource',架构'sys'上的EXECUTE权限被拒绝。

any suggestions?

2 个解决方案

#1


You have to be a member of the sysadmin role to run this system stored proc to enable debugging.

您必须是sysadmin角色的成员才能运行此系统存储过程以启用调试。

This is different to having permissions to run your code which you created in your database

这与拥有运行您在数据库中创建的代码的权限不同

More info from a blog entry from the "CLR Integration team at SQL Server"... Skip to 3rd paragraph if you have short attention span about why sysadmin rights are needed

来自“SQL Server的CLR集成团队”的博客条目的更多信息...如果您关注为什么需要系统管理员权限的时间很短,请跳至第3段

#2


Your case seems to be a simple question of permissions - if you can't even execute your code, you can't debug it.

您的案例似乎是一个简单的权限问题 - 如果您甚至无法执行代码,则无法对其进行调试。

Once you can execute your code and still run into problems, SQL Server 2008 does offer a T-SQL debugger inside SQL Server Management Studio.

一旦您可以执行代码并仍然遇到问题,SQL Server 2008确实在SQL Server Management Studio中提供了一个T-SQL调试器。

Quite useful if you need to debug complicated T-SQL script batches or stored procs!

如果您需要调试复杂的T-SQL脚本批处理或存储过程,那么非常有用!

Marc

#1


You have to be a member of the sysadmin role to run this system stored proc to enable debugging.

您必须是sysadmin角色的成员才能运行此系统存储过程以启用调试。

This is different to having permissions to run your code which you created in your database

这与拥有运行您在数据库中创建的代码的权限不同

More info from a blog entry from the "CLR Integration team at SQL Server"... Skip to 3rd paragraph if you have short attention span about why sysadmin rights are needed

来自“SQL Server的CLR集成团队”的博客条目的更多信息...如果您关注为什么需要系统管理员权限的时间很短,请跳至第3段

#2


Your case seems to be a simple question of permissions - if you can't even execute your code, you can't debug it.

您的案例似乎是一个简单的权限问题 - 如果您甚至无法执行代码,则无法对其进行调试。

Once you can execute your code and still run into problems, SQL Server 2008 does offer a T-SQL debugger inside SQL Server Management Studio.

一旦您可以执行代码并仍然遇到问题,SQL Server 2008确实在SQL Server Management Studio中提供了一个T-SQL调试器。

Quite useful if you need to debug complicated T-SQL script batches or stored procs!

如果您需要调试复杂的T-SQL脚本批处理或存储过程,那么非常有用!

Marc