Racim BOUDJAKDJI
asked on
Passing a list of variables to a stored procedure
Hi all,
I am looking for the most efficient way to pass a list, serie or array of variables to a SQL Server stored procedure and process it at once. THks fr your help.
Sincerely,
Racimo
I am looking for the most efficient way to pass a list, serie or array of variables to a SQL Server stored procedure and process it at once. THks fr your help.
Sincerely,
Racimo
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Alternatively can you save your array in the temporary table and call the SP, that uses this table. You have nothing to parse then.
ASKER
anrazame,
Thks for the feedback. I don't really need an output on this CFSTOREDPROC. I know I would have to pass it as a varchar but that does not tell what would be the best way for SQL Server to process; I need some kind of stored procedure example that does the job.
Sincerely,
Racimo
Thks for the feedback. I don't really need an output on this CFSTOREDPROC. I know I would have to pass it as a varchar but that does not tell what would be the best way for SQL Server to process; I need some kind of stored procedure example that does the job.
Sincerely,
Racimo
ASKER
I'd rather not do any unuseful write operation. I thought about creating a temp table but I prefer to make a single process that processes the varchar. Is there some kind of SQL Server user-defined function that does the job?
Sincerely,
Racimo
Sincerely,
Racimo
I agree w/ anrazame, the simplest way is to pass the data comma delimited and make the stored proc handle it.
CJ
CJ
ASKER
Hi guys,
I KNOW that passing it as a string would be the solution. I was just expecting an optimized and complete solution. BTW, I found a solution which is to create a T-SQL function to emulate the split VB function then use the CFSTOREDPROC to pass the varchar delimmited string. I guess I should have asked this question on the SQL board...
As it's my mistake, I will grant the points to anrazame.
Here is the link to the solution I have found for anybody interested
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlmag01/html/TreatYourself.asp
I KNOW that passing it as a string would be the solution. I was just expecting an optimized and complete solution. BTW, I found a solution which is to create a T-SQL function to emulate the split VB function then use the CFSTOREDPROC to pass the varchar delimmited string. I guess I should have asked this question on the SQL board...
As it's my mistake, I will grant the points to anrazame.
Here is the link to the solution I have found for anybody interested
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlmag01/html/TreatYourself.asp