hi sqllearnercorrect me if I'm wrong (not sitting in front of SQL Server at the moment) but doesn't your string need to enquote the values?ieSET @test = '''' + 'asc131458' + '''' + ',' + '''' + 'ret131466' + ''''and then you'd need to use dynamic sql to run the query.Basically what I'm saying is that you can't just pass in a string with commas in it - it needs to be strings separated by commas, eg where X in ('bla','bla2')rather than where X in ('bla,bla2')etcThen you'll have to run a dynamic SQL queryeg SET @SQL = 'select * from tbl_employee_details where emp_id in(' + @TEST + ')'exec(@SQL) etc etc(again - sorry not in front of SQL Server for specifics)Alternatively, if you have several values as separate varchars, you can do select * from tbl_employee_details where emp_id in (@testa, @testb)
etc--I hope that when I die someone will say of me "That guy sure owed me a lot of money"