do you know query how to get list of privileges for user or for session in DB2?
Some similar to Oracle query:
select * from session_privs;
Thanks,
Vaclav
In db2 you can use the table function: AUTH_LIST_AUTHORITIES_FOR_AUTHID
select authority, d_user, d_group, d_public, role_group, role_user, role_public, d_role
from table (sysproc.auth_list_authorities_for_authid ('sapbw','U')) as t
order by authority"
For more information:
http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.sql.rtn.doc/doc/r0052898.html
Related
Is there a simple query that will let me distinguish Cloud SQL from stock PostgreSQL? Maybe something like select version() or select current_setting('server_version')?
(I don't have access to a Cloud SQL instance to experiment.)
For the most part, things are the same. You could try looking for the CLOUDSQLSUPERUSER role, which wouldn't existing on regular postgres (unless you or someone else has added it).
EDIT: added #enocom's suggestions for a query to do this:
select * from pg_catalog.pg_user where usename = 'cloudsqlsuperuser';
I granted permission for read_only user in postgres for some columns of a table using
grant select(col1,col2) on mytable to read_only_user;
I want to use
SELECT * FROM mytable
query from read_only_user.But I'm getting permission denied in output.I don't want to create view for this. But somehow I want the select * query to work for that user(not explicitly telling what are the columns like select col1,col2 from mytable).
Help me guys.Thanks in advance...
You cannot do that, and you shouldn't try.
SELECT * should never be used in code, it is only for ad hoc queries.
What are the problems:
If the table definition changes, your program will break.
You probably retrieve unnecessary columns, which will cause unnecessary data to be processed and may keep PostgreSQL from choosing a better execution plan.
I am unable to write a query in oracle SQL 10_g which uses all types of constraints using employees and departments tables.
Can you help me with the same?
Do you mean:
select * from all_constraints
where table_name in ('EMPLOYEES', 'DEPARTMENTS');
I have executed the following query:
SELECT productid,
FORMAT(productid, 'd10') AS str_productid
FROM Production.Products;
I it is sayng that 'FORMAT' is not a recognized built-in function name.
I am using the TSQL2012 database and Microsoft SQL Server 2012 Express.
Can some one tell me what is wrong? The Express verssion has not included Format function?
Try this
ALTER DATABASE database_name
SET COMPATIBILITY_LEVEL = 110
here are details
I am trying to read data from AS400 DB using Excel, VBA and ODBC driver. Connection is successful but none of the queries are retrieving data from DB. For ex: The select query is not working:
select * from QSYS2.SysTables;
The Client gets the following error message:
[IBM] [System i Access ODBC Driver] [DB2 for i5/OS] SQL0104 - Token; void. Valid tokens: <END Instruction>.
What is wrong with my query?
Edit: I am trying to read data from AS400 only not from DB2. I want to read the table names from SysTables(system table).
Remove the statement termination character (;) for a single statement execution.
This is an example for retrieving queries:
"Select * from Tablename";
If it doesn't work, try checking the manual for query in Microsoft. It's different from standard SQL queries.