I have a table name but I am not sure in which schema that table exists. How to find the schema name?
Because tables and views are in the same namespace, a table and a view in the same schema cannot have the same name. However, tables and indexes are in different namespaces. Therefore, a table and an index in the same schema can have the same name.
You can get a list of the schemas using an SSMS or T-SQL query. To do this in SSMS, you would connect to the SQL instance, expand the SQL database and view the schemas under the security folder. Alternatively, you could use the sys. schemas to get a list of database schemas and their respective owners.
Select owner
from dba_tables
where table_name = 'YOUR_TABLE_NAME'
Here you can find something more.
Something like this should get the name of the table and the the schema it belongs to .
select owner, table_name
from all_tables
where table_name like 'GL%';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With