Get all table names of a particular database by SQL query

0 votes

I'm developing a program that can interact with different database servers, including "MySQL" and "MS SQL Server."

I want to use a universal query that should work with all database types to extract the names of the tables in a specific database. I've attempted the following:

SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE='BASE TABLE'

But it only provides the table names for the selected database, not those for all the databases on a given server. How can I limit this query to just return tables from a specific database?

Aug 22 in Database by Kithuzzz
• 11,640 points
13 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Database

0 votes
0 answers

Display names of all constraints for a table in Oracle SQL

I have given each constraint a name ...READ MORE

Aug 15 in Database by Kithuzzz
• 11,640 points
57 views
0 votes
2 answers

Write a SQL query to find the names of employees that begin with ‘S’

Select ename From emp Where ename like"s%"; READ MORE

answered Oct 7, 2021 in Database by anonymous
14,650 views
0 votes
1 answer

Query to list number of records in each table in a database

Use the below code to list number of ...READ MORE

answered Oct 11, 2019 in Database by Omaiz
• 560 points
713 views
0 votes
1 answer

How to drop all tables from a database with one SQL query?

Use the INFORMATION_SCHEMA.TABLES view to get the ...READ MORE

answered Feb 4 in Database by Neha
• 8,920 points
293 views
0 votes
0 answers

How do I get list of all tables in a database using TSQL?

How can I find out the names ...READ MORE

Aug 30 in Database by Kithuzzz
• 11,640 points
22 views
0 votes
0 answers

How can I get column names from a table in SQL Server?

I want to search for every column's ...READ MORE

Sep 3 in Database by Kithuzzz
• 11,640 points
20 views
0 votes
1 answer

Calculate Time Intersection to Correlate Sequences of Independent Events

I think this solution requires a CROSS JOIN implementation. ...READ MORE

answered Oct 26, 2018 in Power BI by Upasana
• 8,620 points
330 views
0 votes
1 answer

How do I UPDATE from a SELECT in SQL Server?

MERGE INTO YourTable T USING ...READ MORE

answered Feb 3 in Database by Vaani
• 7,020 points
119 views
0 votes
0 answers

How do I UPDATE from a SELECT in SQL Server?

INSERT INTO Table (col1, col2, col3) SELECT col1, ...READ MORE

Feb 4 in Database by Vaani
• 7,020 points
44 views
0 votes
1 answer

What is a stored procedure?

A stored procedure is a set of ...READ MORE

answered Feb 4 in Database by Neha
• 8,920 points
214 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP