C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

sql querry


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



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





Responses

Author: ManoKarthikeyan    10 Jul 2006Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

show tables;


Author: vishal     10 Jul 2006Member Level: GoldRating: 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



Author: Vimal Verma    10 Jul 2006Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

select * from sys.tables


Author: divya    13 Oct 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 1

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



Author: Kavitha    13 Oct 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 1

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


Author: Deepika Haridas    07 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 0

show tables;



Thanks & Regards,
Deepika
Editor

If U want to shine like a SUN..First U have to burn like the SUN!!
Need a Guide? Join my mentor program..



Author: Mohammed Khaja Najmuddin    10 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 1

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



Author: B. Gopal Surya Prakash    11 Nov 2008Member Level: SilverRating: 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



Author: Rajalakshmi    13 Nov 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 1

hi...

Simply u use the query

sp_tables under ur database



Author: Sravya    18 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 1

sql server 2000

select name from sysobjects where type ='u'

it will display only tables



Author: Sriman N Vangala    19 Nov 2008Member Level: DiamondRating: 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: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use