“计数”查询运行良好。只要注释部分保持原样,“记录页”查询就可以正常运行。如果未注释它永远不会返回......继续前进。任何有关如何克服这一点的帮助将不胜感激。
-- Page or records
DECLARE @p0 int;
DECLARE @p1 int;
SET @p0 = 100;
SET @p1 = 20;
SELECT DISTINCT ZIP_CODE, RowNum
FROM ( SELECT ROW_NUMBER() OVER (ORDER BY ZIP_CODE) as RowNum, ZIP_CODE
FROM ODS.PHP1300_DWH.FACETS_MEMBER
--WHERE LEFT(ZIP_CODE, 5) NOT IN (SELECT SHORT_ZIP_CODE
-- FROM DWH.Reference.R_ZIP_CODE)
) AS x
WHERE RowNum BETWEEN @p0 + 1 AND @p0 + @p1
ORDER BY RowNum
-------------------------------------------------------------------------------------
-- Count
SELECT COUNT(ZIP_CODE)
FROM ODS.PHP1300_DWH.FACETS_MEMBER
WHERE LEFT(ZIP_CODE, 5) NOT IN (SELECT SHORT_ZIP_CODE
FROM DWH.Reference.R_ZIP_CODE)