Sql server 如何查询数据库中任何返回特定名称的字段/列值的存储过程?

Sql server 如何查询数据库中任何返回特定名称的字段/列值的存储过程?,sql-server,schema,database-schema,database-metadata,server-explorer,Sql Server,Schema,Database Schema,Database Metadata,Server Explorer,我想查询数据库的元数据,查找从名为“bidprice”的字段或列返回值的任何存储过程 对于如何搜索需要一组特定参数的存储过程,即具有名为Unit、Member、BegDate和EndDate的参数的存储过程,我得到了一个很好的答案,如下所示: ; WITH T AS (SELECT [specific_name] FROM information_schema.parameters WHERE [parameter_name] = '@Unit' UNION ALL SELECT [specif

我想查询数据库的元数据,查找从名为“bidprice”的字段或列返回值的任何存储过程

对于如何搜索需要一组特定参数的存储过程,即具有名为Unit、Member、BegDate和EndDate的参数的存储过程,我得到了一个很好的答案,如下所示:

; WITH T AS (SELECT [specific_name] FROM information_schema.parameters WHERE [parameter_name] = '@Unit'
UNION ALL
SELECT [specific_name] FROM information_schema.parameters WHERE [parameter_name] = '@Member'
UNION ALL
SELECT [specific_name] FROM information_schema.parameters WHERE [parameter_name] = '@BegDate'
UNION ALL
SELECT [specific_name] FROM information_schema.parameters WHERE [parameter_name] = '@EndDate')
SELECT [specific_name] 
FROM T
GROUP BY [specific_name] HAVING COUNT(*) = 4
这是完美的;因此,我希望找到返回特定名称的字段/列值(如“bidprice”)的存储过程所需的可能是这样简单的东西:

; SELECT [specific_name] FROM information_schema.COLUMNS WHERE [COL_NAME] = "bidprice"
FROM T
…但在Visual Studio.Server Explorer中尝试(右键单击数据库连接的Tables文件夹,然后选择New Query),我得到:

对于这种类型的查询,[specific_name]是否错误? 对于这种类型的查询,列或[colu_NAME]是否错误

我还尝试通过以下方式简化查询:

; SELECT [specific_name] FROM information_schema.COLUMNS WHERE [COL_NAME] = "bidprice"
…但得到:

Msg 207, Level 16, State 1, Line 1
Invalid column name 'COL_NAME'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'bidprice'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'specific_name'.
(删除带前缀的“;”时也会出现相同的错误)


搜索结果集中返回名为“bidprice”的字段/列的存储过程的正确方法是什么。看一看

information\u schema.COLUMNS不用于搜索存储过程中的返回列,我猜是这样的;使用了什么?我不知道您是否真的可以在存储过程中搜索返回列。我将从sys.sql_模块存储过程中的搜索文本开始
Msg 207, Level 16, State 1, Line 1
Invalid column name 'COL_NAME'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'bidprice'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'specific_name'.