我有这个SQL Server存储过程:
use PracticeDatabase
Go
alter procedure spGetEmpByGender
@gender nvarchar(50),
@name nvarchar(50) output
as
begin
select @name = Emp_Name
from tblPracticeEmpTable
where gender = @gender
End
declare @EmpNames nvarchar(50)
exec spGetEmpByGender 'male', @EmpNames output
select @EmpNames
执行上述程序时,我收到此错误:
Msg 217,Level 16,State 1,Procedure spGetEmpByGender,Line 10
最大存储过程,函数,触发器或视图嵌套级别 超过(限制32)。
答案 0 :(得分:0)
执行以下操作,看看会发生什么
use PracticeDatabase
Go
IF OBJECT_ID('spGetEmpByGender') IS NOT NULL
DROP PROCEDURE spGetEmpByGender
GO
CREATE procedure spGetEmpByGender
@gender nvarchar(50),
@name nvarchar(50) output
as
begin
select Top 1 @name = Emp_Name
from tblPracticeEmpTable
where gender = @gender
End
GO
declare @EmpNames nvarchar(50)
exec spGetEmpByGender 'male', @EmpNames output
select @EmpNames
GO