Stored procedures 如何写如果=Sql StoredProcess中的IsNull
在这里,我编写了一个小的StoredProcess,当Id不可用时,它会显示给其他人 请帮帮我Stored procedures 如何写如果=Sql StoredProcess中的IsNull,stored-procedures,Stored Procedures,在这里,我编写了一个小的StoredProcess,当Id不可用时,它会显示给其他人 请帮帮我 Alter procedure Sp_GetEmpById (@Id int) As Begin if(@Id!==ISNULL){ select Email,Gen,Country from Employee where Emp_Id =@Id } Else print 'The Id Enter By u is Not Availabe '+@Id End 在这里,我在ISNULL处得到两个错
Alter procedure Sp_GetEmpById
(@Id int)
As
Begin
if(@Id!==ISNULL){
select Email,Gen,Country from Employee where Emp_Id =@Id
}
Else
print 'The Id Enter By u is Not Availabe '+@Id
End
在这里,我在ISNULL处得到两个错误,然后u输入的Id不可用'+@Id'
@Id
这将编译,但我不确定您的要求:
create procedure Sp_GetEmpById @Id int
as
begin
if @Id is not NULL
select Email,Gen,Country from Employee where Emp_Id = @Id
else
print 'The Id Enter By u is Not Availabe ' + @Id
end
如果@id不为null,但
Employee
表中不存在此id,该怎么办?