T-SQL STOP or ABORT command in SQL Server

后端 未结 9 590
轻奢々
轻奢々 2021-01-01 08:44

Is there a command in Microsoft SQL Server T-SQL to tell the script to stop processing? I have a script that I want to keep for archival purposes, but I don\'t want anyone t

9条回答
  •  余生分开走
    2021-01-01 08:58

    Try running this as a TSQL Script

    SELECT 1
    RETURN
    SELECT 2
    SELECT 3
    

    The return ends the execution.

    RETURN (Transact-SQL)

    Exits unconditionally from a query or procedure. RETURN is immediate and complete and can be used at any point to exit from a procedure, batch, or statement block. Statements that follow RETURN are not executed.

提交回复
热议问题