Forums

ASP

This topic is locked

Stored Procs and Lists

Posted 21 years ago
1
has voted
21 years ago Phil Atkinson posted:
I have a checkbox that will send one or more variables to the next page. Accordingly, I have an SQL statement that uses IN (as opposed to using OR). If I embed the SQL in the SQL page, I don't have a problem. However, in order to improve performance, I would like to create the SQL as a stored proc and send the variable to the server.

Is this possible? If yes, what the most effective solution?

Thanks

Replies

Replied 21 years ago
21 years ago Phil Shevlin replied:
Its possible, but we would need more info before someone could suggest "effectiveness"
Replied 21 years ago
21 years ago Phil Atkinson replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Its possible, but we would need more info before someone could suggest "effectiveness"
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
I basically have a simple checkbox form that offers the user 1 or more selections. Accordingly 1 or more variables are sent as a string to results.asp. If for example GERMAN & DUTCH have been selected, GERMAN,DUTCH is passed. However is use some simply VBscript to change the string to GERMAN','DUTCH which is then inserted into the following stored proc.

CREATE Procedure TestProc
@varMarket as varchar(100)
AS
DECLARE @SQL varchar(8000)
set @SQL = 'Select * From CO_Contract Where CO_CM_ID IN (' + @varMarket + ')'
EXEC (@SQL)
GO

However when I test the proc I get "Invalid Column Name 'GERMAN' for example when testing only one variable. I don't understand this at all.

Any ideas?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Reply to this topic