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 2000 Forums
 Transact-SQL (2000)
 Pass a set of variables

Author  Topic 

misterraj
Yak Posting Veteran

94 Posts

Posted - 2004-12-20 : 01:09:50
Hi,
I need to pass a set of variables say(15) to a Stored Proc. This stored proc inturn calls another stored procedure where all these variables are used. There are lot of internal stored procedures called within and all these set of variables are passed.

The cumbersome task is that I donot know how to make the set of variables global as all these variables at some point of time are used for processing.

Each time I am passing all these variables to each procedures and getting back all these variables as ouput and then feeding again all.. This is too annoying for me. Is there any other way to tackle this.

In oracle there is a concept of making these variables global putting them as type record (sort of structure type in C). Passing the struct name alone makes it to act the variables globally
Is there any similar in SQL?

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2004-12-20 : 01:42:27
You could put the values into a temp table.

HTH

=================================================================

Happy Holidays!
Go to Top of Page

misterraj
Yak Posting Veteran

94 Posts

Posted - 2004-12-20 : 02:07:54
can you elaborate?

Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-12-20 : 06:26:30
create a global temp table, insert/update the values you need. i think that's what he meant

--------------------
keeping it simple...
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2004-12-20 : 10:19:05
select "Temporary tables"
from BooksOnline



HTH

=================================================================

Happy Holidays!
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-12-20 : 21:07:33
Copycat.

Seriously, you could use the global temp table and you should be fine. If the values rarely ever change though, just put them in a real lookup table. ???

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

misterraj
Yak Posting Veteran

94 Posts

Posted - 2004-12-21 : 04:01:06
I dont know what is a global temp table. I am a beginner to SQL - server. can any one of you write a small piece of example of using the stored procedure1 values in stored procedure2 using this concept of temp tables.

I would really appreciate it.



Go to Top of Page

misterraj
Yak Posting Veteran

94 Posts

Posted - 2004-12-21 : 05:41:24
Ya I got it.

Thanks
Go to Top of Page
   

- Advertisement -