try below: alter PROCEDURE PROC_JISUAN @x1 decimal(2,0)=null, @x2 decimal(2,0)=null, --@result decimal(7,2) output, @result1 Nvarchar(24) output AS
begin
if isnull(@x1,0)=0 and isnull(@x2,0)<>0 select @result1='x1为空' if isnull(@x1,0)<>0 and isnull(@x2,0)=0 select @result1='X2为空' if isnull(@x2,0)<>0 and isnull(@x1,0)<>0 select @result1='都不为空' print @result1 end go declare @res Nvarchar(24) exec proc_jisuan 3.0, null ,@res output select @res
alter PROCEDURE PROC_JISUAN @x1 decimal(2,0)=null,
@x2 decimal(2,0)=null,
--@result decimal(7,2) output,
@result1 Nvarchar(24) output
AS
begin
if isnull(@x1,0)=0 and isnull(@x2,0)<>0
select @result1='x1为空'
if isnull(@x1,0)<>0 and isnull(@x2,0)=0
select @result1='X2为空'
if isnull(@x2,0)<>0 and isnull(@x1,0)<>0
select @result1='都不为空'
print @result1
end
go
declare @res Nvarchar(24)
exec proc_jisuan 3.0, null ,@res output
select @res
你的STORED PROCEDURE有问题,你试试我的看看.