存储过程中还有一个额外的`END`?它编译?

ric*_*ard 1 sql-server

我正在解码一个非常复杂的存储过程,其中一部分是匹配BEGIN END对.

除了一个问题,我把它们全部匹配起来...END在存储过程结束时,我还有一个额外的挂起...像这样:

                CLOSE      cursorSelect
          DEALLOCATE cursorSelect  

          /* Select into the record set */
          select *
          from ##tempTable2
          order by selection  

          drop table ##tempTable1
          drop table ##tempTable2  

      commit transaction  

      RETURN

END  --this is the END that seems to have no corresponding `BEGIN`
Run Code Online (Sandbox Code Playgroud)

我算了,有62 BEGIN秒和63 END秒.疯狂的是如果我删除最后一个END,SP不再编译.还有一些其他命令需要END终止它BEGIN吗?

这里发生了什么?

Ada*_*ger 7

在我的头顶,我猜你有一个CASE声明,终止于END.
你能检查一下,还是发布整个查询?