gpt4 book ai didi

sql-server - 抛出错误与升高错误

转载 作者:行者123 更新时间:2023-12-02 09:22:48 26 4
gpt4 key购买 nike

我正在尝试执行以下代码:

THROW 51051, 'I come from the THROW construct :)', 1 ;

我收到的错误是:

Could not find stored procedure 'THROW'.

THROW 过程不是系统过程吗?为什么找不到?

此外,unsing THROWErrorState 之间有什么区别?其中一个比另一个旧/新/更好吗?ErrorState 中的“ErrorSeverity”和“ErrorState”是什么意思?我可以按照自己的意愿定义它们还是预定义它们?

最佳答案

根据Differences Between RAISERROR and THROW in Sql Server :

Both RAISERROR and THROW statements are used to raise an error in Sql Server.

The journey of RAISERROR started from Sql Server 7.0; whereas the journey of the THROW statement has just begun with Sql Server 2012.

Microsoft is suggesting we start using the THROW statement instead of RAISERROR. The THROW statement seems to be simpler and easier to use than RAISERROR.

关于sql-server - 抛出错误与升高错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24141845/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com