Click here to Skip to main content
15,889,398 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
SQL
DELIMITER $$

USE `employee`$$

DROP PROCEDURE IF EXISTS `selectemployeebyids`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `selectemployeebyids`(IN empid VARCHAR(100))
BEGIN
    SELECT empname,salary,department from emp where empid IN (empid) ORDER BY empid;
    END$$

DELIMITER ;



Can anyone please help me

Manju K
Posted
Comments
AmitGajjar 23-Jul-12 4:30am    
Whats your problem ? Please post error message.
manjukgowda 23-Jul-12 5:19am    
Actually by the above procedure i want to retrive empname , salary , department from employee table whose employee id is 101,102,103 and 104
AmitGajjar 23-Jul-12 5:23am    
if you are passing empid as 101,102,103.. then your query should return result. execute this query individually and check result.
manjukgowda 23-Jul-12 5:28am    
I'm passing that empids as varchar so that it takes as

Where empid IN ('101,102,103,104')

it returns result only for empid = 101
AmitGajjar 23-Jul-12 5:29am    
do you have other records in database ? are you executing this query individually or by using exec ?

1 solution

Hi,

Just Remove Quotation mark from your C# code when you are passing your value in your stored procedure.

That may work for you,

Thanks
-Amit Gajjar.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900