問題タブ [raiserror]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
4 に答える
9083 参照

tsql - Case ステートメント内の RAISERROR

T-SQL の case ステートメント内でエラーを発生させることはできませんか? 私はいつもSQLケースステートメントに問題があります:/

0 投票する
1 に答える
2623 参照

sql - Custom Errors in Stored Procedure

Most of the discussions online regarding SQL Server's error handling seem to be focus on how to gracefully handle errors thrown by the processing of T-SQL, using THROW, or TRY...CATCH, and so on.

What I have is a Stored Procedure which accepts several parameters. A couple of those parameters must only have values within a certain range, so at the start of my procedure I want to check the values that have been passed from the application (ASP.NET) and return an error if they aren't within the acceptable boundaries.

At the moment I've got:

#xA;

When I execute the procedure that contains this code from within SSMS and pass a value other than 2 or 3, sure enough the message I've specified gets displayed. But it doesn't seem... severe enough. It doesn't seem apparent that an actual error has occurred.

I know it's possible to specify the severity parameter of the RAISERROR statement, but unless I'm going to make it very high (>19, I believe), indicating a fatal system error, I don't think that's going to make much difference.

I'm just wondering whether, with the code I've got, when the web application calls this procedure, it'll actually know that there's been a error. Would the VB.NET code calling the procedure know that an error has been thrown? If not, how could I re-write my procedure so that it would? I'm sure there's a best-practice way of doing this, but at the moment I feel like I'm trying to hack it.

I'm using SQL Server 2012.

0 投票する
2 に答える
1490 参照

sql-server - SQL クエリで @@rowcount の結果を返す

if existsエラーを発生させ、print一致する行数を増やしたかったのですが、これは機能しません。助けてください 。

0 投票する
1 に答える
1431 参照

sql - 特定の非ユーザー定義エラー コードの THROW または RAISERROR

SQL サーバーで特定のエラー コードをトラップするコードをテストしようとしています。エラー コードは 7886 です。

しようとするとTHROW、次のようになります。

しようとするとRAISERROR、次のようになります。

そもそもエラーを引き起こす状況を実際に設定せずに、このような任意のエラーを発生させる方法はありますか?

0 投票する
1 に答える
20 参照

sql - グリッドではなくメッセージでデータを返す

データがグリッドではなくメッセージに既に存在する場合、どうすれば結果を返すことができますか?

サンプル出力

0 投票する
2 に答える
779 参照

sql - RAISERROR WITH NOWAIT バッファリングの回避策

PRINTによる出力のバッファリングを避けるために、PRINTを使用するのではなく、RAISERRORを使用してストアドプロシージャから進行状況の出力を生成しています。RAISERROR が 500 印刷後にバッファリングを開始することを発見しました。この動作を回避する方法はありますか? 以下のクエリは、私の要点を示しています。

0 投票する
1 に答える
268 参照

sql-server-2008 - SQL Server 2008 でコミットとロールバックを使用して 2 つのテーブルにそれぞれネストされた挿入

私はSQLサーバーの初心者です。シナリオを解決するためにコーディングする必要があります。

私は2つのテーブルを持っています。そして、ストアド プロシージャを使用してこれらのテーブルにレコードを挿入しています。ストアド プロシージャには、@name@age、などの入力パラメータが@firstnameあり@lastnameます。

@name最初のテーブルにandを挿入する必要があり@ageます (状態が 18 歳を超える場合)。そして@firstname@lastnameそして@age2 番目のテーブルに (状態の年齢が 20 を超える場合)。

条件または挿入のいずれかが失敗した場合、すべての変更はロールバックされる必要があり、それ以外の場合はコミットが発生する必要があります。

私の問題は、常に外側のキャッチブロックレイザーエラーのみが発生することです。

これが私のコードです。

また、ここで不要なコードを指摘してください。

前もって感謝します。

0 投票する
0 に答える
385 参照

python - Pythonでnumpy.seterrを使用してオーバーフローが発生したときに関数を呼び出す

私は使用しています

私のコードの上部にあります。

次に、次の行もあります。

しかし、「計算に失敗しました!」上げているメッセージが表示されません。オーバーフロー エラーのみが表示されます。

プログラムをクラッシュさせずにオーバーフロー エラーを特定の方法で処理するには、どうすればオーバーフロー エラーをキャプチャできますか? numpy.seterr()可能であれば、を使用せずにオーバーフローをキャッチして処理できれば幸いです。