CTE总是报错.Must declare the table variable "@tablename".
CTE总是报错.Must declare the table variable "@tablename".
declare @tablename nvarchar(50)
set @tablename = '222';
WITH PAGE_CTE
as
(
SELECT CEILING((ROW_NUMBER() OVER (ORDER BY Dpid ASC))/2) AS PageNumber,* FROM @tablename
)
select Dpid,DpBlock from PAGE_CTE where PageNumber=1