Database/SQL Server

SQL Server - 파라미터 옵션(NULL값 True) 주고 실전에 사용하기

청렴결백한 만능 재주꾼 2020. 12. 10. 03:36
반응형
Alter Proc spSearchEmployees
@Name nvarchar(50) = NULL,
@Email nvarchar(50) = NULL,
@Gender nvarchar(50) = NULL,
as 
Begin
	Select * from tblEmployee where
    	(Name = @Name or @Name IS NULL) AND
    	(Email = @Email or @Email IS NULL) AND
    	(Age = @Age OR @Age IS NULL) AND
    	(Gender = @Gender OR @Gender IS null)
End

 

 

 

반응형