I hope this is not too bad of a logic that I am after. I have a web page which has a list/select box. A user may select one or many of the items from the list. This process sends each items database id to the server in following format
String listOfIdees= '12,14,54,87'
I pass this cs list to stored procedure..where I want to check if none of these records already exist or exist using following format
SELECT * FROM mytable WHERE recId in (@listOfIdees)
This of course throws an error that
Conversion failed when converting the varchar value '12,14,54,87' to data type int.
If user selects one record, that is converted to int correctly but when there is a comma separated list then there is exception
Can some kind soul guide that what is the best approach to check records existing in such manner as I don't think I can pass an array of int from my web application to stored procedure?