Help with query
Posted on 2011-09-22
Hello, I'm trying to do this:
declare @Surveynumber varchar(50) set @SurveyNumber = 'Survey - 100089'
declare @SelectedItems varchar(max) set @SelectedItems = ('1647,1648')
Select * from SurveyDetails
Where SurveyNumber = @SurveyNumber
and SurveyDetailId in(select @SelectedItems)
But getting this error:
Conversion failed when converting the varchar value '1647,1648' to data type int.
I'm attempting to pass into the stored procedure a string of surveydetailid in the @SelectedItems but the surveydetailid is integer..
How can I get this to work???