Tuesday, June 30, 2015

Query to get the names of all tables in SQL

SQL Server 
USE your_database SELECT name FROM sys.tables


SQL Server - get the fields info
SELECT TABLE_SCHEMA, TABLE_NAME, 
       COLUMN_NAME, substring(DATA_TYPE, 1,1) AS DATA_TYPE
FROM information_schema.COLUMNS  

ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION


MySQL
select TABLE_NAME from INFORMATION_SCHEMA.TABLES
where TABLE_TYPE = 'BASE TABLE'

3 comments:

Priya Tamil said...

Excellent .. Amazing .. I will bookmark your blog and take the feeds additionally? I’m satisfied to find so many helpful information here within the put up, we want work out extra strategies in this regard, thanks for sharing..

Hadoop Training in Chennai

Abiya Carol said...

This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.

PPC Services in Chennai

Shalini said...

Great site for these post and i am seeing the most of contents have useful for my Carrier.Thanks to such a useful information.Any information are commands like to share him.

digital marketing company in india