ALTER PROCEDURE your_sp_name ASBEGIN 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…
测试数据:Northwind 链接地址: https://files.cnblogs.com/files/louiszh/NorthWind.zip 首先创建一个测试存储过程: IF EXISTS (SELECT 1 FROM SYSOBJECTS WHERE id = object_id ('pr_test')) DROP PROCEDURE pr_test go CREATE PROCEDURE pr_test AS SELECT TOP 4 * FROM Customers SELECT…