用户自己的架构 table 的 SELECT 权限被拒绝

The SELECT permission on table of user's own schema was denied

我在 VB 6.0 上有两个应用程序,AppOK 和 AppFailed。两者都使用用户 AppUser 连接 SQL 服务器上的数据库并查询 table。 AppOK 成功,AppFailed 失败并显示以下错误消息。

Run-time error '-2147217911 (80040e09)':

The SELECT permission was denied on the object 'xxxxx', database 'xxxxx', schema 'xxxxx'.

AppUser 的架构中存在 table,当我明确向用户授予 SELECT 权限时,它显示

Cannot grant, deny, or revoke permissions to sa, dbo, entity owner, information_schema, sys, or yourself.

AppFailed 能够查询模式中的所有其他 tables,但在新创建的 4 tables 上失败,而 AppOK 可以查询所有这些。

两个应用程序的连接字符串完全相同。在与 AppUser 连接时通过 Management Studio 查询这 4 个新的 tables 工作正常。 AppUser 没有任何 DENY 权限。

我无法找出问题。

很明显,从 AppFailed 连接的用户角色存在一些差异。

使用 SQL Profiler 跟踪来自两个应用程序的警告和错误。您在 SQL Profiler 中查找的特定事件在此处描述: Exception Event

一定要包括与用户登录相关的列,并从两个应用程序中寻找 activity 的差异。

这里有一些关于使用 SQL Profiler 跟踪错误的信息:https://nimblegecko.com/how-to-trace-sql-server-database-errors-and-exceptions-with-sql-profiler/

试试这个

1) dbaccess 系统管理员 2) 将 syssqlstat 上的 select 授予 public;

:(。应用程序在建立连接后立即更改用户本身的角色(我不知道这一点),该角色对新创建的表没有权限。