Professional Web Applications Themes

How to list all tables of a SQL database - Microsoft SQL / MS SQL Server

Hi: I found out the query for listing all fields from SQL database which is : select * from sysobjects. But I am looking for listing of all the tables from sysobjects.Any ideas as to how to do it? Thx Rahul...

  1. #1

    Default How to list all tables of a SQL database

    Hi:

    I found out the query for listing all fields from SQL
    database which is :

    select * from sysobjects.

    But I am looking for listing of all the tables from
    sysobjects.Any ideas as to how to do it?

    Thx
    Rahul
    rahul Guest

  2. #2

    Default Re: How to list all tables of a SQL database

    You should read in the BOL about the information_schema views, e.g., select
    * from information_schema.tables

    hth
    Eric

    "rahul" <com> wrote in message
    news:002501c36b2d$042af3d0$gbl... 


    Eric Guest

  3. #3

    Default Re: How to list all tables of a SQL database

    There are many methods you can find, if you search the archives of this
    Newsgroups. Here is an easy one :

    EXEC sp_tables

    Using sysobjects,

    SELECT *
    FROM sysobjects
    WHERE type = 'U' ;

    --
    - Anith
    ( Please reply to newsgroups only )


    Anith Guest

  4. #4

    Default Re: How to list all tables of a SQL database

    "rahul" <com> wrote in message
    news:002501c36b2d$042af3d0$gbl... 

    If you're using SQL Server 2000 you can do:

    select TABLE_NAME
    from INFORMATION_SCHEMA.TABLES


    John Guest

  5. #5

    Default How to list all tables of a SQL database

    If you want to get a list of all tables in the database,
    you can use the INFORMATION_SCHEMA.TABLES system view:

    E.g.

    select TABLE_NAME from INFORMATION_SCHEMA.TABLES

    Per Books OnLine, sysobjects contains one row for each
    object (constraint, default, log, rule, stored procedure,
    and so on) created within a database. In tempdb only, this
    table includes a row for each temporary object.

    Let me know if it helps.

    Edgardo Valdez
    MCSD, MCDBA, MCSE, MCP+I
    http://www.edgardovaldez.us/
     
    Edgardo Guest

Similar Threads

  1. mysql dbi list of tables
    By neo ancient in forum PERL Modules
    Replies: 3
    Last Post: October 7th, 03:56 AM
  2. List Access database tables
    By Kevin Ingram in forum ASP Database
    Replies: 7
    Last Post: January 9th, 04:09 AM
  3. Getting list of available tables
    By TsTom in forum Oracle Server
    Replies: 1
    Last Post: January 14th, 03:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139