我正在尝试使用 spyProcedure ,但它没有按预期工作。以下是场景,请帮助我在哪里做错了?
**CREATE PROC [dbo].[proc3](@id int , @marks int out)
as
begin
select @marks = marks from student where id=@id;
end**
CREATE PROC [dbo].[proc4](@id int , @marks int )
as
begin
print 'inside proc4 id ' + cast(@id as varchar) + ' marks ' + cast(@marks as varchar);
update student set marks = @marks where id=@id;
end
**CREATE PROC [dbo].[proc6](@id1 int , @id2 int)
as
begin
declare @marks int;
EXEC tSQLt.SpyProcedure 'proc3' , 'SET @marks = 80';
set @marks = @marks + 20;
print ' marks = ' + cast(@marks as varchar);
EXEC proc4 @id = @id2 , @marks = @marks;
end**
EXEC proc6 @id1 = 1 , @id2 = 2;
GO
当我调用上述内容时,它无法执行/调用“EXEC proc4 @id = @id2, @marks = @marks;” 但是当我评论“EXEC tSQLt.SpyProcedure 'proc3', 'SET @marks = 80';”时,它就可以被执行了。
你能帮我在哪里做错了以及如何正确执行它。
谢谢你。