Can i get database name with respect to schema name in snowflake - snowflake-cloud-data-platform

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

Related

what are the metatable details in snowflake

What to know list of metadata tables details in snowflake.
in oracle we have user_tables..etc
like oracle what to know metadata table in snowflake.
Eg: select *From user_tables
where table_name='EMP';
Metadata is stored in
Information Schema:
The Snowflake Information Schema (aka “Data Dictionary”) consists of a set of system-defined views and table functions that provide extensive metadata information about the objects created in your account.
SELECT *
FROM INFROMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'EMP';

Which Admin table has databse names in it in snowflake

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

List Database Scoped DM Views in SQL Server

Server-scoped Dynamic Management View are stored only in the Master database.
SELECT name, type, type_desc
FROM sys.system_objects
WHERE name LIKE 'dm%'
ORDER BY name
How to list Database-Scoped DM Views and where it stored?
Can you advise?
Server-scoped Dynamic Management View are stored only in the Master
database.
Not exactly. DMVs are stored in the internal mssqlsystemresource database but are visible in all databases. You should get the same results if you run your query from any database, assuming you're not limited by permissions.
Database-scoped DMVs generally have prefix 'dm_db_' and can be listed with the query below.
SELECT name, type, type_desc
FROM sys.system_objects
WHERE name LIKE N'dm%[_]db[_]%'
ORDER BY name;

tsql: select view from different database

Is it possible to select view defined in different database in MS SQL Server?
All my searching results point to defining view to use data from different database, but haven't found if it possible to select view from another database yet.
suppose you want to do a select on database DBOther than it would be :
select * from DBOther..TableName
Also check if the table or view is on the dbo schema, if not you should add the schema also : Please notice I use only one dot now after the database name
select * from DBOther.dbo.ViewName
Make sure the Database is in the Linked Server if they are not on the same server.
Then you can access the table or view on that database via:
SELECT * FROM [AnotherServerName].[DB].[dbo].[Table]
If on same server:
SELECT * FROM [DB].[dbo].[Table]

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

Resources