Here is my table named Employee
-----------------------
Column Name | Data Type
----------------------
ID | int
EmpId | nvarchar
Name | nvarchar
Salary | decimal
Have a look all the records of the table
------------------------------
ID | EmpId | Name | Salary
------------------------------
1 | 200 | Bulbul | 2000.00
2 | 201 | Ahmed | 2000.00
3 | 202 | Rakib | 2500.00
4 | 203 | Rubel | 3000.00
5 | 204 | Zia | 4000.00
Now if I want get all the records of a given employee id to the IN operator, I get the following result. It's just fine.
SELECT EmpId, Name, Salary
FROM Employee
WHERE EmpId IN ('200','201')
------------------------------
ID | EmpId | Name | Salary
------------------------------
1 | 200 | Bulbul | 2000.00
2 | 201 | Ahmed | 2000.00
But if I pass the employee id as parameter, then I don't get my desired results. Just get empty result.
DECLARE @Params AS NVARCHAR(MAX) = '''200'',''201'''
SELECT EmpId, Name, Salary
FROM Employee
WHERE EmpId IN (@Params)
------------------------------
ID | EmpId | Name | Salary
------------------------------
| | |
| | |
Now I need to get the following result using parameter in IN operator. My desired result is something like:
------------------------------
ID | EmpId | Name | Salary
------------------------------
1 | 200 | Bulbul | 2000.00
2 | 201 | Ahmed | 2000.00
Please help me to get my desire result. Thank in advance.