开发者

Can parameterized queries have output parameters?

开发者 https://www.devze.com 2022-12-08 13:09 出处:网络
In SQL Server is there a way to have an output parameter return the total number of records (for paging) in a parameterized q开发者_StackOverflow社区uery?A stored procedure can have an output paramete

In SQL Server is there a way to have an output parameter return the total number of records (for paging) in a parameterized q开发者_StackOverflow社区uery?


A stored procedure can have an output parameter, but not a standard query. You could execute an initial query to get the record count, or return mutliple results sets from one query.


No, but You can do something like that:

SELECT
**,
COUNT(*) OVER(PARTITION BY ID)
FROM TABLE

Not very pretty, but returns record count. You can also use ROW_NUMBER().

0

精彩评论

暂无评论...
验证码 换一张
取 消