Write a query to list the user tables within a database

  • Hi,

    What is User Tables?

    Are these different from the tables that we create within a database?

    Write a query to list the user tables within a database.

    Thanks

    Thanks,
    Santhosh


    Human Knowledge Belongs To The World !!

  • SELECT name FROM sysobjects WHERE xtype = 'U'

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • OK.

    User tables are those tables you create on the database.

    Now if you type the following query then you will get a list of all user tables on the database:

    Select *

    From Sys.Tables

    ---- and the same applies for user views and stored procs. see this link for more info:

    http://www.alberton.info/sql_server_meta_info.html

  • User tables, as has already been stated, are your tables. This is opposed to system tables (and views) which are the management tables (and views) for SQL Server itself.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply