How do I list the available tables in a database I'm
querying?

Answers were Sorted based on User's Feedback



How do I list the available tables in a database I'm querying?..

Answer / guest

You can get a list of tables in a database by calling the
INFORMATION_SCHEMA.Tables view like this:

SELECT * FROM information_schema.tables

Is This Answer Correct ?    7 Yes 0 No

How do I list the available tables in a database I'm querying?..

Answer / shraddha

sp_tables

Is This Answer Correct ?    3 Yes 0 No

How do I list the available tables in a database I'm querying?..

Answer / kumar.t

Simple query

To Display only user created table.

Select * from sysobjects where xtype='u'

To Display all table.

Select * from sysobjects

Is This Answer Correct ?    3 Yes 0 No

How do I list the available tables in a database I'm querying?..

Answer / sanjeev kumar

First Method:

select table_name from information_schema.tables


Second Method:

Select Name from sysobjects where xtype='u'

Note: here 'u' means user created

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

SQL Server Performance Tuning for Stored Procedures & reducing debugging time?

1 Answers   CarrizalSoft Technologies,


Explain what are various ways to enhance the ssrs report?

0 Answers  


how to know description of a table in sqlserver 2000

8 Answers  


Can you roll back the ddl statement in a trigger?

0 Answers  


What is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting is possible?

0 Answers  






How can we determine what objects a user-defined function depends upon?

0 Answers  


Disadvantages of the indexes?

0 Answers  


what is the main difference between after trigger and instead trigger.

2 Answers  


Syntax to find the used space and free space of the Data file in a database(SQL Server). Following queries didn't give the exact Used space and Free Space Information sp_spaceused;DBCC showfilestats;exec MyDbName.dbo.sp_spaceused;SP_HELPFILE Can any one tell me the query for how to find the exact used data file space and free space in a Data File?

2 Answers   Cognizant,


How is foreign key related to primary key?

0 Answers  


Differentiate between truncate vs delete in mssql?

0 Answers  


What is an index?

8 Answers   Yardi Software,


Categories