I want to pass,
@sql= "Selecet col1, col1 from myTable orderby col1"
Or If needed split into two sql parameter, or any which way to generalize it. So I can pass various sqls select statements?
I want to know how to make it into dynamic query so it can work? I am using msql 8 express edition.
CREATE PROCEDURE dbo.GetProductsPaged
@PageSize int = 50
SET NOCOUNT ON ;
WITH PagingCTE AS (
ROW_NUMBER() OVER (ORDER BY Col1) ROW -- Change col1 as appropriate
WHERE Row BETWEEN @StartRowIndex AND @StartRowIndex + @PageSize - 1