HOW TO GET TABLES LIST IN SQL SERVER DATABASE

In this articel i explain you how to get list of tables in sql server database
Below is the query
Gets list of tables 
SELECT*FROM SYSOBJECTS WHERE xtype='U'
     (OR)
SELECT *FROM sys.tables
Gets list of tables and views
SELECT *FROM INFORMATION_SCHEMA.TABLES
Gets list of stored procedure
SELECT*FROM SYSOBJECTS WHERE xtype='P'
Gets list of views
SELECT*FROM SYSOBJECTS WHERE xtype='V'
To get the list different objects types(xtype) from database
SELECT DISTINCT xtype FROM SYSOBJECTS

No comments:

Post a Comment