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 |
|
Malli123
Starting Member
2 Posts |
Posted - 2010-12-08 : 15:09:01
|
| I have a problem where in I have to create a temporary table in stored proc and use the same temp table's data in other stored proc in SQL server. But I want to those stored procs seperately not as nested stored proc in sql server. As I understand, local temp tables would only be available to the session which created it.Is there a way I can run the second stored proc in the same session as previous one so that I am able to access temporary table's data in 2nd stored proc in sql server. Please help !! |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-12-08 : 15:14:15
|
| You can use a gloabl temporary table (##table). Or a regular table. But it would be interesting to see what you're doing as this may not be the best way at all. |
 |
|
|
Malli123
Starting Member
2 Posts |
Posted - 2010-12-08 : 17:23:43
|
| Thanks Russell for your such a quick reply. I have a table with following dataCode : this could repeattype : there would be different predefined types for each codedesc : string of chars (message block )code 2 : unique for each column (this is not be shown in the o/p as this is system generated)Code type description code2 (unique column)123 abc 10123 i ghf 19123 r uyg 21 123 f ihj 34124 pqr 35124 r hgb 23124 i uij 36123 jhy 67123 i uyt 89123 r wty 45125 oiu 46125 i okj 68125 r oiu 12first stored proc would take input parameter as (Code as 123 for eg) show the o/p as Code desc 123 abc 123 jhysecond procedure would take input from the above o/p i.e (Row selected,type) depending on the type entered, would that type detailsfor eg ( 1 for first row and i for type)o/pcode type desc123 i uytbut then if two different users are executing the two procedures simultaneously , the o/p shouldn't mix with each other and should be different based on what they got o/p in first proc. |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-12-08 : 19:18:45
|
| Can't this be combined into one Stored Procedure that takes two parameters? |
 |
|
|
|
|
|