为什么SET NOCOUNT ON修复Excel中的嵌入式查询 [英] Why does SET NOCOUNT ON fix an embedded query in excel

查看:33
本文介绍了为什么SET NOCOUNT ON修复Excel中的嵌入式查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对SQL较新,并且找到了解决我问题的方法,但是对本网站不熟悉,它不允许我对其进行评论以使它更清晰地工作.我试图将SQL查询嵌入到excel中,直到在DECLARE之前将NOCOUNT ON设置为ON,该查询才起作用.我希望有人可以告诉我为什么这可以解决我的问题,所以我可以更好地理解它.我最初的查询在Management Studio中运行良好,但是excel不喜欢它.下面是我找到答案的帖子的链接.我的查询与我找到的答案中的示例相似.感谢任何见识!

I am newer to SQL and found an answer to my problem, but being new to this site it won't allow me to comment on it to get clarity about how it worked. I tried to embed a SQL query in excel and it wouldn't work until I SET NOCOUNT ON before my DECLARE. I was hoping someone could tell me WHY this fixed my issue, so I can understand it better. My original query ran fine in management studio, but excel did not like it. The link to the post where I found the answer is below. My query was similar to the example in the answer I found. Appreciate any insight!

https://stackoverflow.com/a/28906577/7982728

推荐答案

我不是Excel中嵌入式SQL的专家,但是如果没有SET NOCOUNT ON,则会返回附加结果集以及受影响的行数.因此,这将返回两个结果集.

I'm not an expert in embedded sql in Excel but without SET NOCOUNT ON an additional resultset is returned with the number of rows affected. This would therefore return two resultsets.

这篇关于为什么SET NOCOUNT ON修复Excel中的嵌入式查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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