Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 SQL Server 中,有没有办法让输出参数返回参数化查询中的记录总数(用于分页)?
存储过程可以有输出参数,但不能有标准查询。您可以执行初始查询以获取记录数,或从一个查询返回多个结果集。
不,但你可以这样做:
SELECT **, COUNT(*) OVER(PARTITION BY ID) FROM TABLE
不是很漂亮,但返回记录数。您也可以使用 ROW_NUMBER()。