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)
 table variable as input parameter

Author  Topic 

javaisok
Starting Member

11 Posts

Posted - 2003-10-23 : 02:13:54
Hi all,
is it possible to pass a table variable as input parameter to a stored procedure? I need to pass n indexes (PKS) to the procedure. Yes, i could use varchar with CSV and generate sql expression but this is not useful in my case bacause i want to make a loop over them. Is there any good solution ?

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-10-23 : 02:37:29
No you can't pass a variable of table datatype as a parameter. If you are using SQL Server 2000, this is an excellent solution to parsing a CSV into rows:

http://www.sqlteam.com/item.asp?ItemID=11499

Owais


Make it idiot proof and someone will make a better idiot
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-10-23 : 04:19:42
You could create a temp table, then access the temp table from the other procedure.
But the real question is .... WHY do you need to loop over the rows ?

Databases are meant to work in sets, if you have to do sequencial processing, you are usually doing something wrong.


Damian
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-23 : 12:41:59
javaisok, perhaps if you let us know what your procedure needs to do, we would be able to come up with an efficient solution for you.

Tara
Go to Top of Page
   

- Advertisement -