为什么在 throw
语句之前需要有分号?
https://learn.microsoft.com/en-us/sql/t-sql/language-elements/throw-transact-sql
最佳答案
它可以解决一些歧义
比较
BEGIN TRAN THROW --Starts a transaction named "THROW"
BEGIN TRY
SELECT 1 / 0
END TRY
BEGIN CATCH
ROLLBACK TRAN
THROW /*Rolls back the transaction named "THROW"*/
END CATCH
至
BEGIN TRAN THROW --Starts a transaction named "THROW"
BEGIN TRY
SELECT 1 / 0
END TRY
BEGIN CATCH
ROLLBACK TRAN; /*rolls back the tran without caring about the name*/
THROW --rethrows the error
END CATCH
关于sql-server - throw 语句前加分号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48141513/