Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 在没有事先声明的情况下使用临时表_Sql Server_Sql Server 2008 R2 - Fatal编程技术网

Sql server 在没有事先声明的情况下使用临时表

Sql server 在没有事先声明的情况下使用临时表,sql-server,sql-server-2008-r2,Sql Server,Sql Server 2008 R2,我有一个存储过程。我不知道结果集的数据类型。我希望避免预先声明表模式 现在,我想将过程的结果集存储在一个临时表中。在伪SQL中,它将如下所示: select * into #table1 exec proc_name 什么才是真正的SQL呢?步骤1:创建临时表。说#temp 步骤2: 我不想创建模式。比如:-create table#table 1(…)@Gopal看看如果你事先不知道模式,你怎么可能在结果表上执行任何有用的工作?我将根据过程的输出创建临时表。在这种情况下,临时表将与proc的

我有一个存储过程。我不知道结果集的数据类型。我希望避免预先声明表模式

现在,我想将过程的结果集存储在一个临时表中。在伪SQL中,它将如下所示:

select * into #table1 exec proc_name

什么才是真正的SQL呢?

步骤1:创建临时表。说#temp 步骤2:


我不想创建模式。比如:-create table#table 1(…)@Gopal看看如果你事先不知道模式,你怎么可能在结果表上执行任何有用的工作?我将根据过程的输出创建临时表。在这种情况下,临时表将与proc的结果集紧密耦合,我不想要。还有其他方法吗?
INSERT INTO #temp
exec proc_name