|
EMP |
ID |
Name |
Country |
Salary |
1 |
Vijay |
India |
6000 |
2 |
Bill |
USA |
8000 |
3 |
Kris |
France |
3000 |
|
DECLARE @IDs varchar(10)
SET @IDs = '1,7,9' -- Array of ID No.s
SELECT ID,Name,Country
FROM EMP
WHERE ( ',' + @IDs ) LIKE ( '%,' + cast( ID as varchar(5)) + ',%' )
|
Output |
ID |
Name |
Country |
Salary |
|
1 |
Vijay |
India |
6000 |
|
|