June 6, 2012

sp_procedures_rowset (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_procedures_rowset(nvarchar @procedure_name
, int @group_number
, nvarchar @procedure_schema)

MetaData:

   
create procedure sys.sp_procedures_rowset
(
@procedure_name sysname,
@group_number int = 1,
@procedure_schema sysname = null
)
as
select
PROCEDURE_CATALOG = db_name(),
PROCEDURE_SCHEMA = schema_name(pro.schema_id),
PROCEDURE_NAME = convert(nvarchar(134),pro.name +';'+ ltrim(str(pro.procedure_number,5))),
PROCEDURE_TYPE = convert(smallint, 3), -- DB_PT_FUNCTION
PROCEDURE_DEFINITION = convert(nvarchar(1),null),
DESCRIPTION = convert(nvarchar(1),null),
DATE_CREATED = pro.create_date,
DATE_MODIFIED = convert(datetime,null)
from
sys.spt_all_procedures pro
where
(
(@procedure_schema is null and pro.name = @procedure_name) or
object_id(quotename(@procedure_schema) + '.' + quotename(@procedure_name)) = pro.object_id
) and
(@group_number is null or pro.procedure_number = @group_number)
order by 2, 3

No comments:

Post a Comment

Total Pageviews