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
 SQL Server Development (2000)
 Passing variable Nos of parameters, total > 8000 chars

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-01-23 : 08:38:22
Brysie writes "I need to pass a variable number of VARCHAR parameters to a stored procedure. I had passed them in a single VARCHAR(8000) with separator characters, but the cumulative length now needs to be able to exceed 8000 characters.

I've tried using TEXT instead of VARCHAR but I can't slice it.

I've also tried putting in many parameters:
@pv_1 = '',
@pv_2 = '',
....
@pv_10 = ''

and accessing them with a loop variable and EXECUTE:
EXECUTE ('SET @lv = @pv_' + @IX)

but the parameter goes out of scope, so that doesn't work either.

Is there a neat solution to this, or must I use multiple assignments in the stored procedure?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-01-23 : 13:23:14
Here's a question: what is the absolute MAXIMUM amount of parameters you need to pass? You can always use multiple varchar(8000) CSVs and then split each one as needed. Technically, you could pass over 1,000 varchar(8000) CSVs to a stored procedure, I can't imagine that you'll exceed that! You won't be able to manipulate a text variable at all, because READTEXT and such require a text pointer to operate, and a text variable doesn't have one.

Go to Top of Page
   

- Advertisement -