Problem with IN Statement in SQL Server
Posted on 2012-03-20
I currently have a a query where I pass in some delimited values as a varchar. When I go to test against this list in my Where clause SQL Server freaks out and tells me I need to have integers . Not sure what to do.
in C# I pass this in as - @states='AL,CT,FL'
Then in my query it looks like this :
Where dhpDriver.State in(@states)
error I get is :
Conversion failed when converting the varchar value 'AL,CT,FL' to data type int
The dhpDriver.State field is not an integer field so I'm a bit confused.Any idea what I need to do with my states list to make this work ? Any advice would be much appreciated.