Skip to main content

This worked for me.

I declared a temp table and used it to receive the values from the select statement.

Something like below.

declare @i int

declare @v int create table #t (val int) insert into #t exec ('declare @i int set @i = 0 select @i+1') select * from #t

declare @i int declare @v int create table #t (val int) insert into #t exec ('declare @i int set @i = 0 select @i+1') select * from #t 

This worked for me.

I declared a temp table and used it to receive the values from the select statement.

Something like below.

declare @i int

declare @v int create table #t (val int) insert into #t exec ('declare @i int set @i = 0 select @i+1') select * from #t

This worked for me.

I declared a temp table and used it to receive the values from the select statement.

Something like below.

declare @i int declare @v int create table #t (val int) insert into #t exec ('declare @i int set @i = 0 select @i+1') select * from #t 
Source Link
Vinod
  • 33.1k
  • 35
  • 100
  • 119

This worked for me.

I declared a temp table and used it to receive the values from the select statement.

Something like below.

declare @i int

declare @v int create table #t (val int) insert into #t exec ('declare @i int set @i = 0 select @i+1') select * from #t