MySQL Forums
Forum List  »  Stored Procedures

PROCEDURE MSSQL TO MYSQL
Posted by: ELTON BRITO EEE
Date: June 04, 2017 11:23AM

Good afternoon!
I would like help to perform the conversion of a procedure in Microsoft SQL to Mysql, because I am not succeeding.
-------------------------------------------
CREATE PROCEDURE [dbo]. [GetCustomers_Pager]
@SearchTerm VARCHAR (100) = ''
, @ PageIndex INT = 1
, @ PageSize INT = 10
, @ RecordCount INT OUTPUT
AT
BEGIN
SET NOCOUNT ON;
SELECT ROW_NUMBER () OVER
(
ORDER BY [CustomerID] ASC
) AS RowNumber
, [CustomerID]
, [CompanyName]
, [ContactName]
, [City]
INTO #Results
FROM [Customers]
WHERE [ContactName] LIKE @SearchTerm + '%' OR @SearchTerm = ''
SELECT @RecordCount = COUNT (*)
FROM #Results

SELECT * FROM #Results
WHERE RowNumber BETWEEN (@PageIndex -1) * @PageSize + 1 AND (((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1

DROP TABLE #Results
END
-------------------------------------------------- ------

Thank you!

Options: ReplyQuote


Subject
Views
Written By
Posted
PROCEDURE MSSQL TO MYSQL
4281
June 04, 2017 11:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.