Skip to content
Loading
syntax error in stored procedure
  • hi
     
    how to check the condition 
     
    in sql server 
     
    like 
     
    i need to get the empid based on the financialyear 
     
    please help me  
  • thanks
  • like empid i need to display emplloyee id which has financial year
  • Rafnas T P

    you mean to say, you want only emplloyee id which has financial year other wise you wanted to display empid doesnot exit

  • yes 
     
    i need to  chek the other conditions in the same stored procedure 
     
    like 
     if financial year null or not
    if financial year exists or not in the table 
     
    please tell me 
  • Rafnas T P
    what all you wanted to check
  • thanks 
     
     
    but i need to check the 2 more conditions in the same procedure 
     
    how ?
     
    please help me this 
     
    thanks 
  • Rafnas T P
    hi,
    try as follows
     
    1. ALTER PROCEDURE [dbo].[SP_Details1]  
    2. (  
    3. @empID varchar(50)=null  
    4. )  
    5. AS  
    6. BEGIN  
    7.   
    8. Declare @records varchar(max)  
    9. set @records='empid doesnot exist'  
    10.   
    11. IF ISNULL(@EmpId,0)!=0  
    12. BEGIN  
    13. if(select Count([Num]) from [Employee] where [Num]= @empID)>0  
    14.  set @records=@EmpId  
    15. END  
    16.   
    17.   
    18. select @records as [EmpID]  
    19. END