Código PHP:
alter PROCEDURE Usp_Listar_HI_Paginar
@PageSize int,
@PageNumber int
as
SELECT Gender,
HealthIssueid,
NickName
Age,
Location,
Specialty,
Date,
Subject,
Symptoms
from (SELECT dbo.Patient.Gender,
lower(HealthIssue.HealthIssueid) as HealthIssueid,
lower(dbo.Patient.NickName) as NickName,
YEAR(GETDATE()) - YEAR(dbo.Patient.Birthday) AS Age,
lower(dbo.Patient.MailingCity + ' ' + dbo.Patient.MailingCountry)AS Location,
lower(dbo.Specialty.SpecialtyName) AS Specialty,
CONVERT(VARCHAR(10),dbo.HealthIssue.CreationDate,103) AS Date,
lower( dbo.HealthIssue.Subject) as Subject,
lower(dbo.HealthIssue.Symptoms) as Symptoms,
ROW_NUMBER() OVER (ORDER BY HealthIssueid ,NickName asc) AS RowNumber
FROM dbo.HealthIssue INNER JOIN
dbo.Patient ON dbo.HealthIssue.PatientId = dbo.Patient.PatientId INNER JOIN
dbo.Specialty ON dbo.HealthIssue.SpecialtyId = dbo.Specialty.SpecialtyId
) as HealthIssue
WHERE RowNumber BETWEEN @PageSize * @PageNumber + 1
AND @PageSize * (@PageNumber + 1)
Código PHP:
exec Usp_Listar_HI_Paginar 10,0