Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Table as output of SP ??? How

Author  Topic 

khufiamalik
Posting Yak Master

120 Posts

Posted - 2008-09-02 : 05:17:38
Hello All,
I want to create a SP that will create some values and place these values in a Table, and this table should be returned to the caller SP.

and before the completion of SP this table should be dropped also.

Can any one give me syntax or hint:


Thanks in advance

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-02 : 05:40:58
CREATE PROC sp1
AS

create table #mytable (i int, j int)

insert #mytable
EXEC sp2
Go
create proc sp2
as
select 1, 2
go


create proc sp3
as

create table #anothertable ( a int, b int, c int)
insert #anothertable
select col1, col2, col3 from a_source

select a, b, c from #anothertable
drop table #anothertable
go



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -