Thursday, 26 September 2013

List of objects from particular schemas

List of objects from particular schemas

This script help to get list of all objects associated with a particular schema.
This can be useful when you want to get all objects for a project to be migrated from one environment to another, but instead of going through each item, one can use the mentioned script and get all objects in matter of seconds.

SELECT name, [type], type_desc FROM sys.objects
WHERE schema_Name(schema_id) = 'dbo'
AND type IN ('U', 'V', 'FN', 'TF', 'TT', 'P')
--U - User Table
--V - View
--FN - Scalar Valued Function
--TF - Table Valued Function
--TT - Table Type

--P - Stored Procedure

No comments: