Sql 仅插入存储过程结果中的特定列

Sql 仅插入存储过程结果中的特定列,sql,sql-server,stored-procedures,insert,Sql,Sql Server,Stored Procedures,Insert,我想知道是否可以从存储过程的结果的特定列插入到表中 比如: declare @temp as table( id int ) insert @temp exec getlistofStudents --returns multiple columns 这只是一个示例,感谢您的帮助。您可以采取两步方法。首先插入一个#tentable,然后选择单个列,用另一个INSERT-to填充@TempVariable DECLARE @temp AS TABLE ( ID int ); CREAT

我想知道是否可以从存储过程的结果的特定列插入到表中

比如:

declare @temp as table(
id int
)

insert @temp
exec getlistofStudents --returns multiple columns

这只是一个示例,感谢您的帮助。

您可以采取两步方法。首先插入一个#tentable,然后选择单个列,用另一个INSERT-to填充@TempVariable

DECLARE @temp AS TABLE
(
   ID int
);

CREATE TABLE #tempTable1
(
   Column1 int,
   Column2 int   
);

INSERT INTO #tempTable1
Exec getlistofStudents

INSERT INTO @temp
SELECT Column1 FROM #tempTable1

您可以从存储过程中获取所有列,而不是单个列。。