declare @val varchar(100)=''
declare @sql varchar(max)
set @val='''a'''+','+'''b'''+','+'''c'''+','+'''d'''
set @sql='select * from tb where id in ('+@val+')'
print @sql
exec (@sql)
string sql = "select * from table where id in ({0})";
string ids = "";
foreach(var item in list)
{
ids+=",'"+item.ToString()+"'";
}
ids = ids.SubString(1);
sql = string.Formart(sql,ids);