[英]Why I got error SQLCODE=-204, SQLSTATE=42704, DRIVER=4.18.60 in execuing below query
When I run: 当我跑步时:
select * from sys.server_role_members ;
got below error: 出现以下错误:
SQLCODE=-204, SQLSTATE=42704, DRIVER=4.18.60
As you seem to be a beginner, you need to know that when asking for help with Db2, it is important to always write your Db2-version and the Db2-server operating system (Z/OS, i-Series(formerly AS/400), or Linux/Unix/Windows ). 您似乎是个初学者,您需要知道在寻求Db2帮助时,务必始终编写Db2版本和Db2服务器操作系统(Z / OS,i系列(以前为AS / 400) ),或Linux / Unix / Windows)。 That's because the three platforms have different capabilities and sometimes the SQL is different also, and the catalog is different.
这是因为这三个平台具有不同的功能,有时SQL也不同,目录也不同。
You get that error because your query is meant for Microsoft SQL-Server databases only. 之所以会出现该错误,是因为查询仅适用于Microsoft SQL-Server数据库。
Your query cannot work on Db2 because Db2 does not allow user-created schema names to begin with SYS. 您的查询无法在Db2上运行,因为Db2不允许用户创建的架构名称以SYS开头。 Some IBM-created schema-names can start with SYS for example SYSIBM and SYSCAT but these are reserved for the catalog and they get created by Db2 during database creation.
一些IBM创建的模式名称可以以SYS开头,例如SYSIBM和SYSCAT,但是它们是为目录保留的,它们由Db2在数据库创建期间创建。
Db2 has tables like SYSIBM.SYSROLEAUTH and SYSIBM.SYSROLES and (on Linux/Unix/Windows) a set of views on these in the SYSCAT schema. Db2具有SYSIBM.SYSROLEAUTH和SYSIBM.SYSROLES之类的表,并且在SYSCAT模式中具有(在Linux / Unix / Windows上)这些表的一组视图。
For example, if your Db2-server runs on Linux/Unix/Windows, then these views exist SYSCAT.ROLES and SYSCAT.ROLEAUTH . 例如,如果您的Db2服务器在Linux / Unix / Windows上运行,则这些视图存在SYSCAT.ROLES和SYSCAT.ROLEAUTH 。
In addition, Db2 for Linux/Unix/Windows provides table function AUTH_LIST_AUTHORITIES_FOR_AUTHID which is quite useful. 另外,用于Linux / Unix / Windows的Db2提供了表功能AUTH_LIST_AUTHORITIES_FOR_AUTHID ,该功能非常有用。
If your Db2-server runs on i-Series, then different tables/views exist. 如果您的Db2服务器在i系列上运行,则存在不同的表/视图。 That's the reason you need to know which platform of Db2 you are using, and write that in your questions.
因此,您需要知道使用的是哪个 Db2 平台 ,并将其写在问题中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.