DB_TablePrivileges Function


Returns a list of tables and the privileges associated with each one. The information is returned as a result set on the specified statement handle.


hstmnt = DB_TablePrivileges (hdbc, catalog-name, schema-name, table-name)
Variable Description

The returned handle to the executed SQL statement. This is an input parameter for other DBTester functions, for example DB_FetchNext. HSQL.


The handle to a database as returned by DB_Connect. HDATABASE.


Catalog name. STRING.


String search pattern for schema names. STRING.


String search pattern for table names. STRING.


  • DB_TablePrivileges corresponds to SQLTablePrivileges. For additional information about SQLTablePrivileges, see SQLTablePrivileges.

  • The following wildcard characters are supported for arguments:
    Wildcard character Matches
    % The percent sign matches any character sequence.
    _ The underscore matches any single character.
  • To omit catalog-name or schema-name, specify the arguments as an empty string ("").

  • When you receive a valid statement handle, you can call DB_FetchNext or DB_FetchPrevious to manipulate the information.


[ ] STRING cat, sch, tab, ignore, name, grantor,grantee, priv
[ ] hstmnt = DB_TablePrivileges (hdbc, cat, sch, tab)
[ ] 
[ ] // retrieve tables, privilege grantee/grantee,& privileges; ignore rest.
[-] while (DB_FetchNext (hstmt, ignore, ignore, name,grantor, grantee, priv) == TRUE) { 
	[ ] //print table names, privilege grantee/grantee,& privileges... 
[ ] }