April 21, 2011 at 1:01 am
i write a stored procedure...
the select statement returns more then one record in that..
how i insert that values into a table
April 21, 2011 at 3:00 am
Declare @command varchar(max)
set @command='exec dbo.sp_spname'
Create table #test (based on the columns returned from the stored procedure)
insert into #test exec (@command)
Ryan
//All our dreams can come true, if we have the courage to pursue them//
April 21, 2011 at 3:34 am
Dynamic SQL isn't necessary:
ALTER PROCEDURE dbo.MyTest
AS
SELECT TOP 10 [name] FROM sys.columns ORDER BY [name]
RETURN 0
GO
CREATE TABLE #ColumnNames ([name] VARCHAR(200))
INSERT INTO #ColumnNames ([name]) EXEC dbo.MyTest
SELECT * FROM #ColumnNames
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply