By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,222 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

How to select all tables in a database?

P: 5

if anyone can help me please,

i nead to select all the tables in my database in one instruction. all the tables have the same structure.
the problem is that i dont know the number of tables neighter their names.

i nead a solution like SELECT * from database_name.*

Oct 20 '10 #1
Share this Question
Share on Google+
2 Replies

code green
Expert 100+
P: 1,726
If you don't know your database structure how can you query it?
To SELECT tables makes no sense.
If you want to SELECT data from multiple tables you need JOIN
Oct 21 '10 #2

Ravi L
P: 12
I dont get exactly what you are trying to do. Below are some suggestions:
List all tables in the database-
Select * from sys.objects where type='u'

Generate Select query for all tables in database-
Select 'Select * from '+name from sys.objects where type='u'

Further to this, clarify exactly what you intend to do.
Oct 21 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.