CREAT PROCEDURE tester
AS
BEGIN
SET NOCOUNT ON;
DECLARE @userId varchar(50)
DECLARE @count int
SET @count = 0
SELECT @count = count(*) FROM UserService_User WHERE Account like '%111%'
WHILE @count > 0
BEGIN
SELECT @userId = Id FROM UserService_User WHERE Account like '%111%'
exec UserService_RemoveUserByUserId @userId
SET @count = @count -1
END
END
exec UserService_RemoveUserByUserId @userId 为执行另一个 存储过程
转载自 : http://www.cnblogs.com/wanggc/p/4361977.html