I'm a Junior Programmer But I need help with a query How do I execute a query showing all tables in a Database ??
Asked
Active
Viewed 161 times
-1
-
`information_schema.tables`, for all tables with some kind off access privilege. – jarlh Apr 25 '17 at 07:38
-
Welcome! put your code example that what you try for. and visit link **[How to Ask](http://stackoverflow.com/help/mcve)** – Zaheer Ul Hassan Apr 25 '17 at 07:40
2 Answers
1
Please try this. It will give you a list of tables except view.
SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_TYPE = 'BASE TABLE'

Rajan
- 303
- 1
- 12
-
-
Its a view and you can refer this link for more info. https://learn.microsoft.com/en-us/sql/relational-databases/system-information-schema-views/system-information-schema-views-transact-sql – Rajan Apr 26 '17 at 05:16
1
Here is the full name of a table with the schema and table well formatted usable in a query.
SELECT QUOTENAME(TABLE_SCHEMA)+'.'+QUOTENAME(TABLE_NAME)
FROM information_schema.tables
WHERE TABLE_TYPE = 'BASE TABLE'

Hybris95
- 2,286
- 2
- 16
- 33