SELECT PARAMETER_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME = 'procedure_name';
SELECT ARGUMENT_NAME, DATA_TYPE FROM ALL_ARGUMENTS WHERE OBJECT_NAME = 'procedure_name' AND PACKAGE_NAME IS NULL;
SELECT PARAMETER_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME = 'procedure_name';
SELECT PARAMETER_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME = 'procedure_name';
其中,'procedure_name'应替换为真实存储过程名称。这些查询可在各种编程语言中执行,并返回参数名称及其数据类型。例如,在Python中,可以通过使用PyODBC库执行以下代码来获取SQL Server中存储过程的参数:
import pyodbc cnxn = pyodbc.connect("Driver={SQL Server};Server=localhost;Database=testdb;Trusted_Connection=yes;") cursor = cnxn.cursor() cursor.execute("SELECT PARAMETER_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME = 'procedure_name'") for row in cursor.fetchall(): print(row.PARAMETER_NAME, row.DATA_TYPE)