标签:
ALTER PROCEDURE your_sp_name
AS
BEGIN
DECLARE @a INT, @b INT, @c INT
SELECT @a= COUNT(1) FROM table_name WHERE 条件1
SELECT @b= COUNT(1) FROM table_name WHERE 条件2
SELECT @c= COUNT(1) FROM table_name WHERE 条件3
SELECT @a AS a, @b AS b, @c AS c
END
--执行
EXEC your_sp_name
--结果
a b c
----------- ----------- -----------
1 2 3
(所影响的行数为 1 行)
标签:
原文地址:http://www.cnblogs.com/johnblogs/p/5916296.html