5

我有一个输出参数@Counter和一个临时表#tmpUsers

是否可以赋值

SELECT COUNT(*) FROM #tmpUsers

输出@Counter参数?

我努力了

SET @Counter = SELECT COUNT(*) FROM #tmpUsers

但这对我不起作用

4

1 回答 1

13

试试这个方法:

SELECT @Counter = COUNT(*) 
FROM #tmpUsers

或者

SET @Counter = (SELECT COUNT(*) FROM #tmpUsers)
于 2013-08-06T10:40:33.433 回答