dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersAamir ali
Raj.Trivedi
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » .NET »

sql querry


Posted Date: 10 Jul 2006      Posted By:: damodar     Member Level: Bronze    Member Rank: 0     Points: 2   Responses: 11



what is the querry to get all the tables in a database?




Responses

#62426    Author: ManoKarthikeyan      Member Level: Silver      Member Rank: 2894     Date: 10/Jul/2006   Rating: 2 out of 52 out of 5     Points: 2

show tables;


 
#62427    Author: vishal       Member Level: Gold      Member Rank: 509     Date: 10/Jul/2006   Rating: 2 out of 52 out of 5     Points: 2

To get all tables in the database you can write select statement as –

SELECT * FROM sysObjects where xtype = ‘U’

U means user tables



 
#62530    Author: Vimal Verma      Member Level: Gold      Member Rank: 1533     Date: 10/Jul/2006   Rating: 2 out of 52 out of 5     Points: 2

select * from sys.tables





 
#306046    Author: divya      Member Level: Gold      Member Rank: 366     Date: 13/Oct/2008   Rating: 2 out of 52 out of 5     Points: 1

select * from sysObjects where Xtype='U'
or
select * from sys.tables where type='U'



 
#306318    Author: Kavitha      Member Level: Silver      Member Rank: 1784     Date: 13/Oct/2008   Rating: 2 out of 52 out of 5     Points: 1

To get all the tables, use sp_tables in a paticuler DB.

Regards,
Kavitha N



 
#314207    Author: Deepika Haridas      Member Level: Gold      Member Rank: 7     Date: 07/Nov/2008   Rating: 2 out of 52 out of 5     Points: 0

show tables;



Thanks & Regards,
Deepika - Sr. Editor
Webmaster, GujaratSpider
http://angeldeeps.blogspot.com/
"Experience is the name everyone gives to his mistakes"
GujaratSpider - Post and Earn



 
#314523    Author: Mohammed Najmuddin      Member Level: Gold      Member Rank: 968     Date: 10/Nov/2008   Rating: 2 out of 52 out of 5     Points: 1

This will display information of all tables .
select * from information_schema.tables;



 
#315527    Author: B. Gopal Surya Prakash      Member Level: Silver      Member Rank: 865     Date: 11/Nov/2008   Rating: 2 out of 52 out of 5     Points: 5

Below queries gives only objects in table

select * from sysObjects

You can different objects based on XType field in where clause

for User Tables
Xtype = 'U'

for View
Xtype='V'

for procedures
Xtype='P'

for Scalar Functions
Xtype = 'FN'


Below query gives tables & view information
select * from information_schema.Tables

Below query gives View & View text information
select * from information_schema.Tables



 
#316614    Author: Rajalakshmi      Member Level: Silver      Member Rank: 0     Date: 13/Nov/2008   Rating: 2 out of 52 out of 5     Points: 1

hi...

Simply u use the query

sp_tables under ur database



 
#318269    Author: Sravya      Member Level: Gold      Member Rank: 477     Date: 18/Nov/2008   Rating: 2 out of 52 out of 5     Points: 1

sql server 2000

select name from sysobjects where type ='u'

it will display only tables



 
#318624    Author: Sriman N Vangala      Member Level: Gold      Member Rank: 119     Date: 19/Nov/2008   Rating: 2 out of 52 out of 5     Points: 4

Various alternatives are there in order to get all the tables information

In sql server 2005, we can use the following

sp_tables
or
SELECT * FROM sys.Objects where type = 'U'
or
select * from sys.tables
or
select * from information_schema.tables where table_type= 'BASE TABLE'

In sql server 2000, we can use the following

SELECT * FROM sysObjects where xtype = 'U'



 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Horizontal Scroll Bar for a listview control
Previous : sql querry interview question
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.