的SqlDependency - 无效的SQL [英] SQLDependency -- Invalid SQL

查看:126
本文介绍了的SqlDependency - 无效的SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最好的我可以告诉这里 ,我没有违反任何规则与此查询,但变化事件触发不断地与无效状态。

Best I can tell from here, I am not breaking any rules with this query, but the change event fires constantly with an invalid status.

SELECT 
    COUNT_BIG([PK_Column]) AS RecordCount 
FROM 
    [dbo].[My_Table] 
GROUP BY 
    Varchar_50_Column

如果我这样做,一切正常。

If I do this, everything works correctly.

SELECT 
    [PK_Column]
FROM 
    [dbo].[My_Table] 

不过,我不想回这么多的数据,以及的SqlDependency似乎需要以后每次执行查询,一旦更改事件触发设置(或复位)认购。

However, I don't want to return this much data, and SqlDependency seems to require executing the query once after each time the change event fires to set up (or reset) the subscription.

任何想法的缺陷是在我第一次查询是什么?

Any idea what the flaw is in my first query?

推荐答案

看一看的 <上查询通知STRONG>特别注意事项 如果您使用的GROUP BY子句,你将不得不使用 COUNT_BIG(*)。在<一个href="http://social.msdn.microsoft.com/Forums/en-US/sqlservicebroker/thread/29f41a3e-85f6-4296-8c81-5b5907b5b2c2"相对=nofollow> social.msdn 我发现有一个类似/同样的问题,其他用户 - 这种说法解决它

Have a look at special considerations on query notifications If you make use of a group by clause you will have to use COUNT_BIG(*). On social.msdn I found another user having a similar / same problem - solving it with this statement.

这篇关于的SqlDependency - 无效的SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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