Multiple update statements in one StoredProcedure

后端 未结 4 1305
梦毁少年i
梦毁少年i 2021-01-17 23:05

I am wondering if it is possible to have multiple Update statements in a store procedure

Something like this:

Update Table1 set field1 = @new_value w         


        
4条回答
  •  灰色年华
    2021-01-17 23:38

    Yes, that works fine.

    Also put this in the stored procedure before the updates:

    set nocount on
    

    This keeps the stored procedures from creating result sets for queries without a result. Otherwise each update will produce an empty result set that is sent back to the client.

提交回复
热议问题