I need to use IN clause in a selection query.
From all the resources that I found from google, it's all about adding a function to split a integer parameter into a list.
But I got a string parameter, for example 'A1,B1,C1'
I tried to use the below where single quotes in @CustCode is double up.
Declare @SQL VarChar(1000)
SELECT @SQL = ' SELECT [something]'
SELECT @SQL = @SQL + ' FROM [Table]'
SELECT @SQL = @SQL + ' WHERE CustomerCode IN (' + @CustCode + ')'
Executing the stored procedure in MSSQL works fine, but it didn't when executing from Visual Studio 2005.
View Complete Post