Professional Web Applications Themes

Select all the user table - Microsoft SQL / MS SQL Server

Hi, Is there a way to select all user tables? For example, I created 5 tables. In SQL yer, I want to select table name and strutures of tables that I have created. Thanks...

  1. #1

    Default Select all the user table

    Hi, Is there a way to select all user tables? For
    example, I created 5 tables. In SQL yer, I want to
    select table name and strutures of tables that I have
    created.

    Thanks
    hngo01 Guest

  2. #2

    Default Re: Select all the user table

    You can do:

    SELECT *
    FROM sysobjects
    WHERE xtype = 'u'

    Or use sp_tables or even query the INFORMATION_SCHEMA views.

    To get the structure you can do:

    EXEC sp_help 'tbl'

    --
    - Anith
    ( Please reply to newsgroups only )


    Anith Sen Guest

  3. #3

    Default Select all the user table

    Use

    select name as tablename from sysobjects where type='u'

    this will give you table names created by user
    >-----Original Message-----
    >Hi, Is there a way to select all user tables? For
    >example, I created 5 tables. In SQL yer, I want to
    >select table name and strutures of tables that I have
    >created.
    >
    >Thanks
    >.
    >
    kannan Guest

  4. #4

    Default Select all the user table

    I'm not sure by what you mean select table name and
    structures but here are a couple of ideas...

    Either one of the following work. The second is probably
    preferred as you are not directly working wity the system
    tables.

    select * from sysobjects where xtype='u' order by name

    select * from information_schema.tables where
    table_type='BASE TABLE'


    For what it's worth.

    Robert
    >-----Original Message-----
    >Hi, Is there a way to select all user tables? For
    >example, I created 5 tables. In SQL yer, I want to
    >select table name and strutures of tables that I have
    >created.
    >
    >Thanks
    >.
    >
    Robert Taylor Guest

  5. #5

    Default Select all the user table

    To see all user tables try:
    select * from sysobjects where xtype = 'U'

    to see user tables and columns names try:
    select o.name, c.name, o.type
    from sysobjects o inner join syscolumns c on o.id=c.id
    where o.xtype = 'U' order by o.name


    >-----Original Message-----
    >Hi, Is there a way to select all user tables? For
    >example, I created 5 tables. In SQL yer, I want to
    >select table name and strutures of tables that I have
    >created.
    >
    >Thanks
    >.
    >
    Andrea Worley Guest

Similar Threads

  1. select next id in table?
    By Jim Michaels in forum MySQL
    Replies: 1
    Last Post: April 23rd, 04:29 AM
  2. insert into...select using the same table
    By Don Vaillancourt in forum MySQL
    Replies: 2
    Last Post: March 22nd, 10:30 PM
  3. multi table select
    By Chuck Anderson in forum MySQL
    Replies: 3
    Last Post: February 10th, 06:39 AM
  4. How to select record on one table but not the other
    By Rustywater in forum Coldfusion Database Access
    Replies: 1
    Last Post: September 11th, 11:15 AM
  5. randomly select a table, better way?
    By Daniel Bray in forum PHP Development
    Replies: 3
    Last Post: September 2nd, 06:25 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