Wednesday, 17 September 2014

How to get Tables list in SQL Server? , how to get stored procedure list in SQL Server? , how to get list of views in SQL Server?

In this article I will explain How to get Tables list in SQL Server? , how to get stored procedure list in SQLServer? , how to get list of views in SQL Server?

Below queries are useful for getting the SQL Tables list:

SQL Server 2005 or 2008 and above:

SELECT * FROM information_schema.tables

SQL Server 2000:

SELECT * FROM sysobjects WHERE xtype='U'

Below queries are useful for getting the Stored Procedure list in SQL Server: 4 ways to get the Stored Procedure list

1.      select *  from information_schema.routines  where routine_type = 'PROCEDURE'

2.   select *   from DataBaseName.information_schema.routines  where routine_type =                              'PROCEDURE'

3.      select *   from DataBaseName.information_schema.routines  where routine_type = 'PROCEDURE'    and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

4.      SELECT name,   type  FROM dbo.sysobjects WHERE (type = 'P')

Below query is useful for getting the Views list in SQL Server:


SELECT * FROM sys.views



No comments:

Post a Comment