SQL 'IN' Statement
I'm trying to figure out how to use the contents of a cell in Excel to populate a SQL IN statement but can't figure it out. Does anybody know if this is possible?
Using a standard IN statement works fine...
And using one based on a cell works fine if theres just a single value in the cell...

But when I enter multiple values like this...

The query fails
Any ideas welcome
D
Using a standard IN statement works fine...
Code:
SELECT *
FROM CRMtest2.dbo.AgendaItems AgendaItems
WHERE (Region IN ('East','West'))
Code:
SELECT * FROM CRMtest2.dbo.AgendaItems AgendaItems WHERE (Region IN (?))
But when I enter multiple values like this...
The query fails

Any ideas welcome

D
you need to seperate the valus in the cells. as it stands, it's ONE string rather than 3. You need a way to seperate them out, putting in the single ' quote marks appropriately. I'll let you figure out how to do this
but it's not that difficult. beware of single quotes within strings tho
but it's not that difficult. beware of single quotes within strings tho
Thread
Thread Starter
Forum
Replies
Last Post
Mkhan
Non Scooby Related
14
Aug 9, 2001 02:07 AM



