Tags: database, equivalent, microsoft, mysql, oracle, select, server, sql, t-sql, tab, tables

How do I get a list of tables in T-SQL

On Database » Microsoft SQL Server

592 words with 2 Comments; publish: Fri, 04 Jan 2008 17:06:00 GMT; (25046.88, « »)

Hi,

Is there anything equivalent to Oracle'sSelect * from tab in MS SQL.

All Comments

Leave a comment...

  • 2 Comments
    • I have got the answer

      select name from sysobjects where type = 'U'

      #1; Fri, 04 Jan 2008 17:08:00 GMT
    • That will work, but try one of these 2 alternate methods to assure forward-compaitbility with future SQL Server versions:

      EXEC sp_table

      SELECT * FROM INFORMATION_SCHEMA.TABLES

      Note that each of the 3 options yields slightly different results as they filter the information differently. Generally sys* tables should not be queried directly as they are subject to chage.

      Terri

      #2; Fri, 04 Jan 2008 17:09:00 GMT