Reputation: 11
I've set up this SQL query in excel:
SELECT * FROM acct.view_op_seremain
WHERE SEC_ID = (?)
I've directed the "?" parameter to cell A1 in Excel. Now, I want this A1 parameter cell to contain multiple values but I am unsure if it requires special formatting? So far I have tried to do the following in Cell A1:
Justin, John, James
('Justin','John','James')
'Justin','John','James'
None of those formats are giving me results. Do you know what I am doing wrong?
Upvotes: 1
Views: 65
Reputation: 71207
You're close. It's just that =
compares only a single value, and you're trying to give it multiple ones. Try an IN
statement:
WHERE SEC_ID IN (?)
And then this input string should work:
'Justin','John','James'
Upvotes: 1
Reputation: 124746
You can't pass multiple parameters in that way.
Depending on what database you're using, you may be able to pass a single string parameter to the databaase engine, and have the database engine split the string for you.
For example, this answer has a solution for SQL Server.
Upvotes: 0