Get all table names by SQL

5 pts.
Tags:
Bib tables
SQL
SQL development
SQL Query
Hi, How can I get all the table names of a bib by a SQL-query? Thank you.

Answer Wiki

Thanks. We'll let you know when a new response is added.

If you are using Microsoft SQL Server you can use one of these queries.

<pre>SELECT *
FROM sys.tables</pre>

or

<pre>SELECT *
FROM sysobjects
WHERE xtype = ‘U’</pre>

If you are using Oracle, you can use one of these:

<pre>SELECT *
FROM all_tables;</pre>

or

<pre>SELECT *
FROM all_objects
WHERE object_type = ‘TABLE’;</pre>

Discuss This Question: 14  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • MelissaWeb
    select * from cat; cat is the abbreviation for user catalog; which gives you the list of all tables.
    10 pointsBadges:
    report
  • msi77
    Standard way:
    select table_name from INFORMATION_SCHEMA.tables
    1,670 pointsBadges:
    report
  • TomLiotta
    If the BIB files (bibliography?... assuming those are what you are referring to) are not in a SQL database, you can't use SQL to get their names. Please provide some description of the environment that you are working in. Tom
    125,585 pointsBadges:
    report
  • Elambodhi
    I am very beginner in SQL. I know the Column name, how to find out the table name by using SQL
    10 pointsBadges:
    report
  • msi77
    select table_name from INFORMATION_SCHEMA.columns where column_name='Your_column_namel'
    1,670 pointsBadges:
    report
  • TomLiotta
    ...how to find out the table name by using SQL That depends on the database product (the DBMS) that you are using. Is it DB2? Oracle? SQL Server? Something else? Tom
    125,585 pointsBadges:
    report
  • AD21
    exec sp_columns yourtable that is get column and exactly data from your table :)
    15 pointsBadges:
    report
  • TomLiotta
    that is get column and exactly data from your table As previously mentioned, that depends on what DBMS is used. AFAIK, it only works for a couple of them. It doesn't work at all for some others. And of those that support sp_columns as a default stored procedure, some don't use "exec". Tom
    125,585 pointsBadges:
    report
  • SDN
    sir i want to select all the table name from database that have column name Pid and Eid. only those table that have these two fields PID and EID.
    15 pointsBadges:
    report
  • Mohsenrezaei
    very very thanks
    10 pointsBadges:
    report
  • ORACLEDATABASE10G
    I am Yogesh.

    Sir i have one dout. In my Database table have some values I have another table that table name and value name is same
    .

    For Example

    Table Name :  OLD1

    _________________
    S.NO    |  NAME
    ----------------------
      1        |    NEW1       // I want to refer this table value NEW1 down side        2     |   YOGESH            table NEW1.  I want this query

    _______________
    ==================================================
    Table Name  : NEW1
    --------------------------
          1      |       BANK
         2       |    NW


    Plse send this query to me .

    Regards
    B.Yogesh
    Mobile No; 07200120365
    Mail Id: yogeshoracle10g@gmail.com
    10 pointsBadges:
    report
  • TomLiotta
    In my Database table...   As already mentioned, you need to tell us what DBMS you're using. Different vendors use different methods. Is it Oracle? DB2? MySQL? SQL Server? Access? Something else?   In essentially every case, you will need a "dynamic" SQL query. For most purposes, it's not a good design. It will not scale well and it won't perform well. In small cases, it can work well enough.   Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    And you shouldn't put phone numbers and e-mail addresses in comments. Put references in your profile if you must.   Tom
    125,585 pointsBadges:
    report
  • Michael Tidmarsh
    For more interesting SQL information, check out Mr. Denny's SQL Server blog!
    30,715 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following