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 |
|
netspider
Starting Member
5 Posts |
Posted - 2007-09-26 : 13:27:41
|
| Not sure if you can help on this but Ive got a stored procedure in sql server and it creates a temp table. I then call another stored procedure from this one. When it returns to the 1st stored procedure I want the temp table to keep the information entered into the table, but the data is lost. Is there a flag that can be turned on and off do this?Or can you suggest anything elseRegardsSteveSteve Fouracre |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-09-26 : 13:30:56
|
| You'd have to post your code in order for us to help.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-26 : 13:31:09
|
It's called SCOPE.Temp tables created in called SP is destroyed when exiting.You can use ##Temp (global temp table), but it's hard to maintain in a multi-user environment. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-26 : 13:37:23
|
This won't workcreate procedure a1asset nocount onexec a2select * from #agocreate procedure a2asset nocount oncreate table #a (i int)insert #aselect 1goexec a1 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-26 : 13:37:47
|
This will workcreate procedure b1asset nocount oncreate table #b (i int)exec b2select * from #bgocreate procedure b2asset nocount oninsert #bselect 2goexec b1 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-09-26 : 13:38:10
|
| If the temp table is created from the parent sproc, then it will exist in the child sproc too as the child is in scope.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
netspider
Starting Member
5 Posts |
Posted - 2007-09-26 : 14:47:24
|
| Thanks for all your comments, I think Ive found a flaw not in the sql but in the php providing the info to the databaseRegardsSteveSteve Fouracre |
 |
|
|
|
|
|