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.
| Author |
Topic |
|
kaspiton
Starting Member
1 Post |
Posted - 2002-07-01 : 05:08:19
|
| Hello!I have some stored procedure:exec sp_aaaWithin sp_aaa i call to second stored procedure (sp_aaa_1),that create table and fill it by some integer values.The name of table i generate by (newid() function).It`s not a temporary table becouse i want use this table inother stored procedure (sp_aaa_2).Into sp_aaa_2 stored procedure i pass name of the table that was created in sp_aaa_1, and declare @t table variable, that i fill byall values of table that was created in sp_aaa_1.Like that i want to simulate pass table parameters in stored procedures, i can`t pass tables in stored procedures.In stored procedure sp_aaa_2 i need do next-------------------------------------create stored procedure sp_aaa_1 @table_name uniqueidentifierasdeclare @t table (var_id int not null)insert into @t (var_id) exec ('select id from ' + @table_name)select 1 as tag, null as parent,c1.id as [somename!1!id],c1.name as [somename!1!name]from continents c1inner join @t t on c1.id=t.var_idfor xml explicitgo-------------------------------------But this statement:insert into @t (var_id) exec ('select id from ' + @table_name)will not work.Any tips how can i do it, and how can i pass tables in stored pcedures?thank you? |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-07-01 : 10:03:59
|
| A temporary table created in stored procedure A is also visible in stored procedure B if A calls B.Jonathan Boott, MCDBA |
 |
|
|
|
|
|