1,105,334 Community Members

Retrieve all Tables from a database

Member Avatar
bnitishpai
Newbie Poster
15 posts since Aug 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

Hello all. I want to know whether it is possible to retrieve list of all tables found in a particular database titled 'Company'? It have got several tables with the names, Suppliers, Customers, etc etc. Just like Oracle, where you retrive all tables using select * from tab; . Is it possible to do the same in MS SQL???

Member Avatar
RaptorSix
Newbie Poster
3 posts since Aug 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

In the mySQL prompt you should be able to type the following and it should show all tables in the database. See the following link for a summary of commands http://www.pantz.org/software/mysql/mysqlcommands.html

show tables
Member Avatar
bnitishpai
Newbie Poster
15 posts since Aug 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

Sorry Mr.RaptorSix. But we are in MS SQL. Not in MySQL. Try again. I owe you. Thanks in advance. Happy New Year.

Member Avatar
BitBlt
Practically a Posting Shark
895 posts since Feb 2011
Reputation Points: 442 [?]
Q&As Helped to Solve: 163 [?]
Skill Endorsements: 16 [?]
Featured
 
1
 

There are a couple of ways to do it, depending on what version of SQL Server you are using and how detailed you need to get. First, in your query tool of choice (usually Management Studio) point to the database you're interested in, then use one of these:

--for SQL2000 or later, you can use either:
select * from sysobjects where type = 'U'
--or
select * from INFORMATION_SCHEMA.TABLES

--for SQL2005 or later, you can also use this:
select * from sys.tables

Hope this is what you're looking for!

Member Avatar
RaptorSix
Newbie Poster
3 posts since Aug 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

Sorry Bnitishpai, i read your post a little too fast! Hopefully BitBit has you covered.

Member Avatar
code739
Posting Whiz in Training
213 posts since May 2012
Reputation Points: 17 [?]
Q&As Helped to Solve: 30 [?]
Skill Endorsements: 6 [?]
 
0
 

Bitbit was right.. thanks dude i have the same problem too...

Question Answered as of 1 Year Ago by RaptorSix, BitBlt and code739
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article