Which Admin table has databse names in it in snowflake - snowflake-cloud-data-platform

I understand that we can do "show databases" in snowflake to get the details of databases. But is there any admin table which i can query.
Actually in my result set I need only database names.
There is an option to use RESULT_SCAN but i am trying to avoid the same.
please advise.

You can use INFORMATION_SCHEMA , and in particularINFORMATION_SCHEMA.DATABASES`, e.g.
SELECT * FROM INFORMATION_SCHEMA.DATABASES

Related

Can i get database name with respect to schema name in snowflake

Hi i am trying to find the names of the database by specfying the name of the schema in snowflake
Easiest way is to query the account usage view called SCHEMATA in the SNOWFLAKE database.
SELECT * FROM snowflake.account_usage.schemata WHERE schema_name = 'NAME-HERE';
I hope this helps...Rich

prevent some user from seeing db2 tables structure

How can I restrict some users in DB2, not to see the table structure. I set the user privilege and restrict user from table access. so that user can not select data or change table but still can see the table structure or describe it.
This problem refers to row access in tables which is added in db2 version 10.
I had this problem too.
you can use this version - if applicable- and restrict user access from specific table structures.
You need to remove the select grant on catalog tables. For example, the following query should return 0 rows when executing with q restricted user.
db2 "select tabschema, tabname from syscat.tables"
All tables and views in the following schemas should not have select on public, nor in any group the restrictive user is in.
sysibm
syscat
db2 revoke select on SYSIBM.SYSTABLES from username

Is there any system defined function to check if user has alter permission?

I am using MS-sql server 2008
I need to know if a user id has "Alter Contraints" permission on one database.
Is there any system defined functions for this ?
This query will show you all the permissions a user has:
select * from fn_my_permissions(NULL, 'DATABASE')
You can also do specific tables, or an entire server.
http://sqltips.wordpress.com/2007/05/28/retreive-current-user-permissions-in-sql-server-2005/
There is HAS_PERMS_BY_NAME()
http://msdn.microsoft.com/en-us/library/ms189802.aspx
Have you seen sys.fn_my_permissions?
http://msdn.microsoft.com/en-us/library/ms176097.aspx
http://www.siusic.com/wphchen/list-all-permissions-a-user-has-in-sql-server-database-error-4064-321.html

How to list all Informix database names

I want to know if there is any way to list (get) all the database names on Informix. I need a proper query or stored procedure to do that.
Alternatively you could execute this query when connected to the sysmaster database:
select * from sysdatabases
More to the point (years after the question was posed):
select name from sysmaster:sysdatabases;
According to the documentation, the command to get a list of the databases on the server you are connected to is simply:
show databases

Oracle database role - select from table across schemas without schema identifier

Which Oracle database role will allow a user to select from a table in another schema without specifying the schema identifier?
i.e., as user A- Grant select on A.table to user B;
B can then- "Select * from table" without specifying the 'A'.
One of our databases allows this, the other returns a 'table or view does not exist' error.
You can create a synonym for this. Create a synonym named "CoffeeTable" on object "A.CoffeeTable". You can create a public synonym so everyone sees it like this, or just a synonym under user B.
Just to double check that the schema you are using doesn't have a private synonym for the table (or a view as Leigh suggests) you could the following
SELECT * FROM all_objects WHERE object_name = 'mytablename'
and look at the owner and object_type information.
Maybe only the current_schema is different. Try:
alter session set current_schema=A
If there isn't a synonym, is there a view in schema B that selects from the table in schema A using the same name as the table? This would appear to be a locally referenced table in many ways.
Brett is right. Synonyms are used for this. In fact there are cases where you do not know what will be the schema name in production. Maybe you use A for some schema name and A is already taken in some Oracle instance.
#erno - probably the reason that TOAD didn't show you the public synonym is because it filters the information shown in the list - I don't have toad in front of me but I think if you right click on tab you will get to the filtering options (eg "only show objects owned by the schema", "show public objects", "show system objects" etc)

Resources