title: SQL Server 2008 R2 If/ else syntax
body: <p>I'm trying to write a fairly simple stored procedure in sql server. If the source of my error is obvious, I'm not catching it. SSMS is giving me "Incorrect syntax near ')'." Any help would be appreciated. Here's the procedure:</p>
  
  <pre><code>SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  ALTER PROCEDURE [dbo].[sprocAddSymbols] @symbol NVARCHAR(10)
  
  AS 
  
  BEGIN
  
  DECLARE @symbolCheck NVARCHAR(10)
  DECLARE @statusCheck NVARCHAR(10)
  
  SET @symbolCheck = (SELECT Symbol FROM tblSymbolsMain WHERE Symbol = @symbol)
  SET @statusCheck = (SELECT SymbolStatus FROM tblSymbolsMain WHERE Symbol = @symbol)
  
  IF (@symbolCheck IS NOT NULL AND @statusCheck = 'Inactive')
  BEGIN
      UPDATE tblSymbolsMain
      SET SymbolStatus = 'Active'
      WHERE Symbol = @symbol
  END
  ELSE
      INSERT INTO tblSymbolsMain (Symbol, DateAdded, Status)
      VALUES (@symbol, GETDATE(), 'Active')
  </code></pre>