Stef Merlijn
asked on
Get total records before paging mechanisms takes effect
Hi,
For Stored Procedure at the bottom I want to get the total number of records that would be retrieved before paging mechanism takes effect. This is than used to calculate the total number of pages for the selection.
For Stored Procedure at the bottom I want to get the total number of records that would be retrieved before paging mechanism takes effect. This is than used to calculate the total number of pages for the selection.
-- Something like???:
SELECT Count(*) AS TotalRecords FROM ZoekfunctieBron
CREATE PROCEDURE [dbo].[sp_Zoekfunctie] (
@ZoekTekst nVarchar(255)
, @RecordsOnPage int
, @SkipPages int
)
AS
BEGIN
;
WITH ZoekfunctieBron ( ID, GevondenTekst, Herkenningstekst, Veldnaam, Tabel, VeldType, IsVerwijderd, RowNumber )
AS ( SELECT Z1.ID, Z1.GevondenTekst, Z1.Herkenningstekst, Z1.Veldnaam, Z1.Tabel, Z1.VeldType, Z1.IsVerwijderd,
ROW_NUMBER() OVER ( ORDER BY Z1.ID, Z1.Tabel ) AS RowNumber
FROM dbo.vwZoekFunctie AS z1
WHERE Z1.GevondenTekst like @Zoektekst
)
SELECT TOP ( @RecordsOnPage )
Z2.ID, Z2.GevondenTekst, Z2.Herkenningstekst, Z2.Veldnaam, Z2.Tabel, Z2.VeldType, Z2.IsVerwijderd, Z2.RowNumber
FROM ZoekfunctieBron AS Z2
WHERE Z2.RowNumber BETWEEN ((@SkipPages * @RecordsOnPage) + 1)
AND ((@SkipPages + 1) * @RecordsOnPage)
;
END
ASKER
But how do I get the variable back with the result?
Also where do I put this code? When I put it ib between the two SELECT statements It is not allowed.
Also where do I put this code? When I put it ib between the two SELECT statements It is not allowed.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Is full-text indexing available and activate by default in Express-editions?
Does it require special settings on the field level?
Can full-text indexing be used on a view? As I search in multiple tables in a view from inside the SP.
Does it require special settings on the field level?
Can full-text indexing be used on a view? As I search in multiple tables in a view from inside the SP.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much.
Open in new window