可能重复:
What's the difference between a temp table and table variable in SQL Server?SQL Server表变量VS临时表
我使用表变量来存储查询的汇总结果。
查询是如下
update @results
set col1 = totals
from (select sum(x) as totals from ......)
where id = 1
如果我使用的查询运行得更快临时表。
在上面的查询中应该使用表变量还是临时表?
我可以俯视吗?
谢谢
我不确定这是否与上述问题完全相同。链接中给出的帖子提到了关于记录计数的性能差异。但在我的情况下,记录计数似乎不是因素,因为只有一个记录正在更新 – user55474 2011-05-10 02:36:33