Thursday, May 08, 2025

Breaking News
>> Securing and encrypt View State and Cookies values  >> Page has one or more controls that do not correspond with   >> “The Controls collection cannot be modified because the control contains code blocks”  >> How to fix "Validation(): Element 'xxxx' is not supported  >> How to create a new session in ASP.NET programmatically  >> MySQL Database Backup using mysqldump command    

Editors Picks

Tuesday, November 8, 2011

pass table name as variable in stored procedure in mysql


CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_getdataforexport`(in tablename varchar(100),in tblcityname varchar(100))
BEGIN
    
      set @citycode= (select citycode from ea_citymaster where cityname=tblcityname);    
      SET @s = CONCAT('select * from ', tablename, ' where CityCode=''',@citycode,'''');
      PREPARE stmt FROM @s;
      EXECUTE stmt; 
    END$$

No comments :

Post a Comment

Contact Us

Name

Email *

Message *