Using an IN list with or without quoted values
The Substitution page of the Select Query Property Editor has an Enclose individual values in quotes option which allows you to specify whether individual items in the list of values should be enclosed in quotes.
This only applies to the “List” option.
You may want to return a list of values without quotes, for example, when passing arguments to stored procedures.
With the quotes option enabled, the returned list will be of the form:
'CODEA','CODEB','CODEC'
With the option disabled, the resulting list will be of the form:
CODEA,CODEB,CODEC
Below are some examples of how the substitution parameter could be configured and used in SQL statements:
Enclose values in quotes
Setup:
SQL:
SELECT PROJECT, COUNT(SITE_ID)
FROM GB_SITE
WHERE PROJECT IN (?Select one or more projects?)
GROUP BY PROJECT
Substitution will yield something like the following:
WHERE PROJECT IN ('PROJECTA','PROJECTB','PROJECTC')
Omit quotes from list of values
Setup:
SQL:
Substitution will yield something like the following:
EXEC dbo.uspGetDrillHoleCounts 'PROJECTA,PROJECTB,PROJECTC'