hi..i need some assistance to convert the MSSQL stored proc to MySql. I am new in this conversion part and I got stuced. Help me out, plz. This is wat i have
Code:
CREATE Procedure spUser_Search_ByType
(
@searchType int,
@searchCriteria nvarchar(50),
@groupType nvarchar(50),
@searchInt int,
@searchString nvarchar(50),
@searchBoolean bit,
@searchDateTime datetime
)
AS
declare @sql nvarchar(500)
set @sql = 'select * from tblUser where recType = ' + '''U'''
-- 0 to search by Integer, 1 to search by String, 2 to search by boolean, 3 to search by DateTime
if @searchType = 0
set @sql = @sql + ' and ' + @searchCriteria + ' = ' + convert(nvarchar, @searchInt)
if @searchType = 1
set @sql = @sql + ' and ' + @searchCriteria + ' like ' + '''%' + @searchString + '%'''
exec sp_executesql @sql
GO
i could not complete this code. Do assist me. i am confused on the part of converting @sql
Code:
--
-- Procedure `dpOptiCMS`.`spUser_Search_ByType`
--
DROP PROCEDURE IF EXISTS `dpOptiCMS`.`spUser_Search_ByType`;
DELIMITER $$
CREATE PROCEDURE spUser_Search_ByType(_searchType int,_searchCriteria
nvarchar(50),_groupType nvarchar(50),_searchInt int,_searchString
nvarchar(50),_searchBoolean bit,_searchDateTime datetime)
BEGIN IF _searchType = 0 THEN
END $$
DELIMITER ;