If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > stored procedure MSSQl -> MySql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-11-08, 04:53
reetha reetha is offline
Registered User
 
Join Date: Jul 2008
Posts: 6
stored procedure MSSQl -> MySql

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 ;
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On