I have a schema in SQL Server 2012.
Is there a command that I can run in SQL to get the names of all the tables in that schema that were populated by user?
I know a similar query for MySQL SHOW TABLES;
but this does not work with SQL Server.
The easiest way to find all tables in SQL is to query the INFORMATION_SCHEMA views. You do this by specifying the information schema, then the “tables” view. Here's an example. SELECT table_name, table_schema, table_type FROM information_schema.
Your should really use the INFORMATION_SCHEMA
views in your database:
USE <your_database_name> GO SELECT * FROM INFORMATION_SCHEMA.TABLES
You can then filter that by table schema and/or table type, e.g.
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'
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