Monday, December 17, 2012

How to get list of sql server database objects?

Problem: How to get list of database objects?

 Solution: You can get list of objects in two ways.

1. Getting the list from sys.objects table. Ex:
 
List of tables:

SELECT *
FROM sys.objects where type='U'

List of stored procedures:

SELECT *
FROM sys.objects where type='P'

List of views:

SELECT *
FROM sys.objects where type='V'


2. Getting the list query from object related tables. Ex:


List of tables:


SELECT *
FROM sys.Tables


List of stored procedures:


SELECT *
FROM sys.procedures


List of views:


SELECT *
FROM sys.views




















No comments:

Post a Comment