5 pts.
 Get all table names by SQL
Hi, How can I get all the table names of a bib by a SQL-query? Thank you.

Software/Hardware used:
ASKED: October 21, 2008  7:34 AM
UPDATED: April 17, 2013  7:01 PM

Answer Wiki:
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>
Last Wiki Answer Submitted:  April 17, 2013  7:01 pm  by  Michael Tidmarsh   11,405 pts.
All Answer Wiki Contributors:  Michael Tidmarsh   11,405 pts. , carlosdl   63,535 pts. , Denny Cherry   64,520 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

select * from cat;

cat is the abbreviation for user catalog; which gives you the list of all tables.

 10 pts.

 

Standard way:

select table_name from INFORMATION_SCHEMA.tables
 1,610 pts.

 

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

 108,225 pts.

 

I am very beginner in SQL. I know the Column name, how to find out the table name by using SQL

 10 pts.

 

select table_name from INFORMATION_SCHEMA.columns where column_name=’Your_column_namel’

 1,610 pts.

 

…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

 108,225 pts.

 

exec sp_columns yourtable
that is get column and exactly data from your table :)

 15 pts.

 

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

 108,225 pts.

 

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 pts.

 

very very thanks

 10 pts.

 

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 pts.

 

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

 108,225 pts.

 

And you shouldn’t put phone numbers and e-mail addresses in comments. Put references in your profile if you must.
 
Tom

 108,225 pts.

 

For more interesting SQL information, check out Mr. Denny’s SQL Server blog!

 11,405 pts.