Mahesh Babu

Mahesh Babu

  • NA
  • 118
  • 32.6k

syntax error in stored procedure

Aug 23 2018 4:57 AM
this is my stored procedure
 
 i need to check the empid null or not
 
after i need to check the empid exists or not in the employee table
 
please help me this  
 
ALTER PROCEDURE [dbo].[SP_Details1]
@empID varchar(50)
AS
BEGIN
Declare @records varchar(max)
IF ISNULL(@EmpId,0)!=0
IF EXISTS (
set @records='empid doesnot exist'
)
BEGIN
select @records= [Num] from [Employee] where [Num]= @empID
select @records as [EmpID]
END
END

Answers (9)