get tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ciary
    Recognized Expert New Member
    • Apr 2009
    • 247

    get tables

    hi all,

    i'm stuck with a certain problem. i need a query to get all tables in a database on a SQL-server. to do this, i thought of 3 options:

    1) stored procedure: sp_tables
    problem: i'm using php. i can execute it, but i can't seem to get the answer.
    2) a simple query like in MySQL
    problem: 'SHOW TABLES' is only supported in mysql, not in mssql as far as i know
    3) reading a system table
    this seems like the best option. is there a table which contains the names of all tables in a database?

    already tnx
  • Ciary
    Recognized Expert New Member
    • Apr 2009
    • 247

    #2
    ah, just found it:

    Code:
    USE myDB
    SELECT name FROM sys.Tables
    ty anyway

    Comment

    Working...