获取存储过程的参数

--获取表的基本信息Owner
select
[TableName]=[Tables].name,[TableOwner]=[Schemas].name
from sys.tables as [Tables]
inner join sys.schemas as [Schemas]
on [Tables].schema_id=[Schemas].schema_id
where [Tables].name='TableName'

--根据表名获取字段列表
select
[ColumnName]=[Columns].name,
[SystemTypeName]=[Types].name,
[Precision]=[Columns].precision,
[Scale]=[Columns].scale,
[MaxLength]=[Columns].max_length,
[IsNullable]=[Columns].is_nullable,
[IsRowGUIDCol]=[Columns].is_rowguidcol,
[IsIdentity]=[Columns].is_identity,
[IsComputed]=[Columns].is_computed,
[IsXmlDocument]=[Columns].is_xml_document,
[Description]=[Properties].value
from sys.tables as [Tables]
inner join sys.columns as [Columns]
on [Tables].object_id=[Columns].object_id
inner join sys.types as [Types]
on [Columns].system_type_id=[Types].system_type_id and is_user_defined=0 and [Types].name<>'sysname'
left outer join sys.extended_properties as [Properties]
on [Properties].major_id=[Tables].object_id and [Properties].minor_id=[Columns].column_id and [Properties].name='MS_Description'
where [Tables].name='" + sTableName + "' order by [Columns].column_id

--获取存储过程参数
select
[ProceduresName]=[Procedures].name,[Owner]=[Schemas].name
from sys.procedures as [Procedures]
inner join sys.schemas as [Schemas]
on [Procedures].schema_id=[Schemas].schema_id
where [Procedures].name='" + ProdecureName + "'"

原文地址:https://www.cnblogs.com/jcgh/p/1969189.html