gpt4 book ai didi

sql-server - SQL Server : catch every error within a database into error table

转载 作者:行者123 更新时间:2023-12-03 08:47:45 25 4
gpt4 key购买 nike

我想知道如何以某种方式钩住SQL Server中的某个数据库,使所引发的每个错误(没有人捕获)都将被捕获并保存到数据库的error_table中。谢谢。

最佳答案

您可以设置警报来执行以下操作:使用错误号创建警报

In Object Explorer, click the plus sign to expand the server where you want to create an alert using an error number.

Click the plus sign to expand SQL Server Agent.

Right-click Alerts and select New Alert.

In the New Alert dialog box, in the Name box, enter a name for this alert.
Check the Enable check box to enable the alert to run. By default, Enable is checked.

In the Type list, select SQL Server event alert.

Under Event alert definition, in the Database name list, select a database to restrict the alert to a specific database.

Under Alerts will be raised based on, Click Severity and then select the specific severity that will raise the alert.
You can add a job step to write to a table with the information from the alert.

关于sql-server - SQL Server : catch every error within a database into error table,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50008911/

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