且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在运行时显示 SQL Server 查询结果中的数据类型和列大小

更新时间:2022-12-03 20:13:33

有点远,尝试使用 SET FMTONLY ON(或关闭).根据 BOL 的说法,这仅向客户端返回元数据.可用于测试响应的格式,而无需实际运行查询."我怀疑这将包含您正在寻找的内容,因为 BCP 使用它.(我在调试一些非常奇怪的 BCP 问题时偶然发现了这个设置.)

A bit of a long shot, try messing around with SET FMTONLY ON (or off). According to BOL, this "Returns only metadata to the client. Can be used to test the format of the response without actually running the query." I suspect that this will inlcude what you're looking for, as BCP uses this. (I stumbled across this setting when debugging some very oddball BCP problems.)