You are here: Re: resultset of proc in another proc « MsSQL Server « IT news, forums, messages
Re: resultset of proc in another proc

Posted by SQL on 10/01/32 11:28

Create a temp table in the first proc (2) and populate that table in
the second proc (1)
Like this

create stored procedure proc1 (@x int) as
insert into #temp values(@ * @x, @x * @x * @x)
select * from @tbl
GO
--
create stored procedure proc2 (@x int) as
declare @tbl (y1 int, y2 int)
create #temp (y1 int, y2 int)
while @x > 0 begin
(exec proc1 @x) <-- this is my problem
set @x = @x - 1
end
insert into @tbl
select * from #temp

select * from temp
---or select * from @tbl -- you can eliminate @tbl in this proc
GO


I don't know why you are calling the second proc you can do all this
stuff in 1 proc like this
-------------------------------------------------------------------------------
create stored procedure proc2 (@x int) as
declare @tbl (y1 int, y2 int)
while @x > 0 begin
insert into @tbl
values(@ * @x, @x * @x * @x)
set @x = @x - 1
end
select * from @tbl
GO



http://sqlservercode.blogspot.com/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация