How to select all tables in a database?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • antoine1987
    New Member
    • Aug 2010
    • 5

    #1

    How to select all tables in a database?

    hi,

    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.*

    thanks
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    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

    Comment

    • Ravi L
      New Member
      • Oct 2010
      • 12

      #3
      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.

      Comment

      Working...