|
-
May 30th, 2003, 08:40 AM
#1
Thread Starter
Fanatic Member
VB create In Clause to pass to Stored Proc
I have VB create a Where clause that I want to pass to a stored procedure in SQL Server.
For example, @myParameter that I am passing in is ("A", "B", "C") and I want to say in my stored proc: Where item IN @myParameter.
Is this possible? It only seems to think that @myParameter is a single item and tries to match the whole string ("A", "B", "C") instead of "A" or "B" or "C".
Any suggestions?
-
May 30th, 2003, 10:05 AM
#2
Huh? It seems like you are trying to pass three values to the same parameter. I think I must have missed something.
-
May 30th, 2003, 10:13 AM
#3
Thread Starter
Fanatic Member
I am trying to pass the string that I want to be used in the WHERE IN clause.
WHERE IN (my parameter value here)
-
May 30th, 2003, 10:48 AM
#4
Frenzied Member
I was stuck with the same issue in access queries. What i did was rebuilding the query in the code. But it does not seem to be a wise solution for Stored Proc.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
May 30th, 2003, 10:57 AM
#5
PowerPoster
I always thought that stored proceedure parameters won't allow that because of SQL Injection attacks. If you think about it, lets say someone specified a parameter of:
;DELETE * FROM Users;
Your parameter would now look like this:
WHERE IN 'A' ;DELETE * FROM Users; 'B'
.... So SQL parameters won't allow that.
What you can do is either run the statement using a regular sql statement without SP's, or provide enough parameters for all the options you need, then use If statements and what not to get the desired effect inside the SP.
-
May 30th, 2003, 10:59 AM
#6
Frenzied Member
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|