How can one pass a parameter into a stored procedure where the parameter is an indirect reference, not a value itself...
For example, in the SP, we would like to receive a parm, defined as @strList varchar(100), which will be in the form of various values....' '66', '67', '68' '...so on. The string could contain one or more of these values, known only at runtime.
Now the SP receiving this parameter does a select as follows:
SELECT col1, col2 WHERE col3 in (@strList)
Using this method finds 0 records. However, if you pass in the literal values. '66' and '67', the the select finds two rows.
Is there a way of passing in a string as a parameter which can be substituted in the where clause???
For example, in the SP, we would like to receive a parm, defined as @strList varchar(100), which will be in the form of various values....' '66', '67', '68' '...so on. The string could contain one or more of these values, known only at runtime.
Now the SP receiving this parameter does a select as follows:
SELECT col1, col2 WHERE col3 in (@strList)
Using this method finds 0 records. However, if you pass in the literal values. '66' and '67', the the select finds two rows.
Is there a way of passing in a string as a parameter which can be substituted in the where clause???