1. 程式人生 > >SQL Server get SP parameters and get output fields type information

SQL Server get SP parameters and get output fields type information

out roc result params osi res describe and 信息

Summary

本文主要介紹一下,SQL裏面的兩個很實用的兩個操作:

獲取存儲過程的參數信息

SELECT *  
FROM INFORMATION_SCHEMA.PARAMETERS 
WHERE SPECIFIC_NAME='proc_name' 
ORDER BY ORDINAL_POSITION 

獲取SQL 語句的執行結果元數據

對應的存儲過程是: sp_describe_first_result_set
例子:

sp_describe_first_result_set @tsql =   
N'SELECT object_id, name, type_desc   
FROM sys.indexes   
WHERE object_id = @id1'  
, @params = N'@id1 int' 

SQL Server get SP parameters and get output fields type information