查询在 Management Studio 中有效,但在客户端中无效
这是一个查询 -
select maclin,mamatn,caname,madesc,madtop,malstd,mastat,ISNULL(sum(tlchgv),0.00) as WIP,
(select isnull(sum(blcost),0.00) from blfile where blclin = maclin and blmatn = mamatn)
as billed,
isnull(rfhghq,0.00),isnull(rffixq,0.00),ISNULL(rfdate,'17770101'),cmidst
from mafile,cafile,tlfile,rffile,cmfile where maclin=caclin and maclin*=tlclin
and mamatn*=tlmatn and
maclin*=rfclin and mamatn*=rfmatn and maclin=cmclin and tlstat='' and
maeact = 32 and maspca = 0
group by maclin,mamatn,caname,madesc,madtop,malstd,mastat,rfhghq,rffixq,rfdate,cmidst
order by caname,maclin,mamatn
如果我在 SQL Server Management Studio 上运行,该查询将在 1 秒内运行并返回 5190 行。
当我通过 ODBC 从 Windows XP PC 桌面上的 Visual Foxpro 程序运行完全相同的查询时,查询没有返回错误,但没有返回行!
如果我将 select top 5000 添加到查询中,它可以工作,但需要 5 分钟。如果我加注选择前 5200 名,它会再次返回任何内容。
使用与 SQL 2000 相同的 Visual Foxpro 程序,它工作得很好。
最奇怪的是。有人对可能出现的问题有任何想法吗?
Here is a query -
select maclin,mamatn,caname,madesc,madtop,malstd,mastat,ISNULL(sum(tlchgv),0.00) as WIP,
(select isnull(sum(blcost),0.00) from blfile where blclin = maclin and blmatn = mamatn)
as billed,
isnull(rfhghq,0.00),isnull(rffixq,0.00),ISNULL(rfdate,'17770101'),cmidst
from mafile,cafile,tlfile,rffile,cmfile where maclin=caclin and maclin*=tlclin
and mamatn*=tlmatn and
maclin*=rfclin and mamatn*=rfmatn and maclin=cmclin and tlstat='' and
maeact = 32 and maspca = 0
group by maclin,mamatn,caname,madesc,madtop,malstd,mastat,rfhghq,rffixq,rfdate,cmidst
order by caname,maclin,mamatn
If I run on SQL Server management Studio, the query runs in 1 second and returns 5190 rows.
When I run the exact same query from a Visual Foxpro Program on the windows XP PC desktop via ODBC, the query returns no errors but no rows!
If I add select top 5000 to the query, it works but takes 5 minutes. If I raise to select top 5200, it retunrs nothing again.
Using the same Visual Foxpro Program with SQL 2000, it works fine.
Most bizarre. Has anyone any ideas as to what may be the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
让我们看看现代语法是否仍然能够获得您想要的结果,而无需花费很长时间。
Let's see if modern syntax still gets the results you're after without taking forever.