适用于VS 2015的SSDT临时表 [英] Temp Tables in SSDT for VS 2015
问题描述
我正在尝试检查存储过程中使用临时表的存储过程并且我收到错误:
" SQL71001找不到支持语句引用的元素"。
我正在使用 TFS
2013 Visual Studio 2015的SSDT
。
有没有解决方法?
你好Alex,
你用什么方法来创建这些临时表?
是否 SELECT INTO ?
如果是这样,请考虑用
CREATE的组合替换这些语句表和 INSERT INTO 命令。
这应该让SQL Server通过事先知道临时表的结构来正确预编译过程,并且它应该消除你所说的错误。
此外,在某些情况下,这可能也无济于事。但另一种解决方案是用
替换临时表变量表(以@而不是#开头。)虽然可能会有性能成本(取决于你如何使用这些表),但它肯定会删除引用错误。
I am trying to check in a stored procedure that is using temp tables inside the stored procedure and and I am getting error:
"SQL71001 Cannot find element referenced by the supporting statement".
I am using TFS
2013
with SSDT
for Visual Studio 2015
.
Is there a way around this?
Hi Alex,
What method are you using to create these temp tables?
Is it SELECT INTO by any chance?
If so, please consider replacing those statements with a combination of CREATE TABLE and INSERT INTO commands.
This should let SQL Server properly pre-compile the procedure by knowing in advance the structure of the temp tables, and it should eliminate the error you're speaking of.
Also, in some cases this may not help either. But an alternative solution is to replace temp tables with variable tables (starting with @ instead of #). There would probably be a performance cost to this though (depending on how you use these tables), but it should definitely remove the reference errors.
这篇关于适用于VS 2015的SSDT临时表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!