如何检索元数据的SQL Server存储过程的返回值 [英] How to retrieve metadata for return values of an sql server stored procedure

查看:141
本文介绍了如何检索元数据的SQL Server存储过程的返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要分析的.NET code的SQL Server存储过程来检索元数据的数据/列返回(而不是输出参数)。当你拖/放一个数据集我的VisualStudio一个SP,它会自动生成列等。这可能是对我来说有些code代我测试了有益的。

I want to analyze an SQL Server stored procedure from .NET code to retrieve metadata for the data/columns it returns (not OUTPUT parameters). Like when you drag/drop a sp on a DataSet i VisualStudio and it automatically generates columns. It could be useful for me for some code generation I'm testing out.

该程序包含简单的SELECT语句喜欢选择A,B从C,我想获得元数据a和b。

The procedures contains simple select statements like SELECT a,b FROM c and I'd like to get metadata about a and b.

推荐答案

您可以使用设置FMT_ONLY ON (并执行) - 但这是一个有点打-N -小姐。它不包括所有方案(分支机构等) - 现在依然可以执行一些code(扩展存储过程等)

You can use SET FMT_ONLY ON (and execute it) - but this is a bit hit-n-miss. It doesn't cover all scenarios (branches, etc) - and can still execute some code (extended stored procedures etc).

或者 - 使用表值函数(UDF)的 - 他们有更丰富的/更正规的元数据

Alternatively - use table-valued-functions (udfs) - they have much richer/more-formal metadata.

这篇关于如何检索元数据的SQL Server存储过程的返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆