title: A cursor with the name 'MY_CURSOR' already exists
body: <p>I try to get data by cursor such as below code but get error that :</p>
  
  <blockquote>
    <p>A cursor with the name 'MY_CURSOR' already exists.</p>
  </blockquote>
  
  <p>I search and found out that I should use <code>LOCAL</code> word  in definition of cursor such as     <code>DECLARE MY_CURSOR LOCAL CURSOR</code>  but get error again that </p>
  
  <blockquote>
    <p>Invalid usage of the option local in the DECLARE CURSOR statement.</p>
  </blockquote>
  
  <p>How can i fix this?</p>
  
  <pre><code>DECLARE @tag AS NVARCHAR(1000)
  DECLARE @tempTbl AS TABLE (tagcol NVARCHAR(1000))
  DECLARE MY_CURSOR LOCAL CURSOR 
  FOR
      SELECT bt.Tag
      FROM   BlogTable AS bt
      WHERE  bt.IsEnglish = 0
             AND bt.IsActive = 1
             AND bt.IsDelete = 0
  
  OPEN MY_CURSOR   
  FETCH NEXT FROM MY_CURSOR INTO @tag
  WHILE @@FETCH_STATUS = 0
  BEGIN
      INSERT INTO @tempTbl
      SELECT *
      FROM   dbo.FunSpliteStr(@tag, '،') 
  
      FETCH NEXT FROM MY_CURSOR INTO @tag
  END
  
  CLOSE MY_CURSOR 
  DEALLOCATE MY_CURSOR
  
  SELECT tagcol
  FROM   @tempTbl AS tt
  GROUP BY
         tt.tagcol
  </code></pre>