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

How to change the data type of an existing column with "alter table" statements in ms sql server?

0 Answers  


write the query for taking database backup in sql

10 Answers   ABC, IBM, Logica CMG, MA,


What specific conditions database should meet, before you can bulk copy data into it using bcp?

0 Answers  


What is the difference between mysql and mysqli?

0 Answers   HCL,


Write a query to get all details of employee who has maximum salary from employee table

8 Answers   AON, Genpact,






Explain what is use of dbcc commands?

0 Answers  


How to transfer data from a cursor to variables with a "fetch" statement?

0 Answers  


Is a null value equal to anything? Can a space in a column be considered a null value? Why or why not?

0 Answers  


What is a system database and what is a user database?

0 Answers  


What is the difference between system objects and user objects?

0 Answers   HCL,


what is the difference between delete table and truncate table commands? : Sql server database administration

0 Answers  


How to transfer an existing table from one schema to another schema in ms sql server?

0 Answers  


Categories