Gcobani Mkontwana

Gcobani Mkontwana

  • 1k
  • 1.3k
  • 109.3k

Incorrect syntax near end

Jan 23 2020 2:14 PM
Hi Team
 
I am tring to create store procedure, some how i am experience this issue 'Incorrect syntax near end'. Who can help me to solve this issue as i dont know how to fix it. Here my store procedure to perform this operation. 
  1. use eNtsaRegistrationDB;  
  2. CREATE proc [dbo].[Usp_CheckUserRoles]  
  3. @UserId int  
  4. as  
  5. begin  
  6. if((select COUNT(WR.UserId) FROM webpages_UsersInRoles WR  
  7. inner JOIN webpages_Roles R on WR.RoleId = R.RoleId  
  8. where WR.UserId =@UserId)> 0 )  
  9. begin  
  10. SELECT 1  
  11. end  
  12. else  
  13. begin  
  14. select 0  
  15. end

Answers (1)