Sunday, 19 January 2014

SQL Server - Query to Get List of Tables in Database in SQL Server 2008

Here I will explain SQL serverquery to get list of all tables in database or get list of all the tables in SQL server 2008database.
Description:

In previous articles I explained can function return multiple values in sql,  Query to get database size in SQL Server, Exception handling in SQL Server with try catch, SQL Query to get first & last day of month, difference b/w view and stored procedure in sql and many articles relating to SQL server. Now I will explain how to get all the tables in SQL server 2008database.
To get all the tables in SQL server 2008databasewe need to write the query like as shown below



USE SampleDB
SELECT * FROM information_schema.tables

                  OR   

USE SampleDB
SELECT * FROM SYS.tables

Once we run above query we will get output like as shown below

Demo



No comments:

Post a Comment

Note: only a member of this blog may post a comment.