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

get tables

Ciary
Expert 100+
P: 247
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
Apr 29 '09 #1
Share this Question
Share on Google+
1 Reply


Ciary
Expert 100+
P: 247
ah, just found it:

Expand|Select|Wrap|Line Numbers
  1. USE myDB
  2. SELECT name FROM sys.Tables
  3.  
ty anyway
Apr 29 '09 #2

Post your reply

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