1

データベースのテーブルを変更したいのですが、これは sql とエラー メッセージです。私はdb2のドキュメントとグーグルで検索しましたが、見つかりませんでした。

ここに画像の説明を入力

4

2 に答える 2

6

-193 などの SQLCODE エラー メッセージが表示された場合は、エラー メッセージ SQL0193 と同じです。ヘルプを表示する最も簡単な方法は、db2 コマンド ウィンドウを使用して次のように入力することです。

db2 ? SQL193

このメッセージは、デフォルトがないと null 以外の列を追加できないことを示しています。列を追加するときにデフォルトを含め、デフォルト値が必要ない場合は、2 番目の alter table ステートメントでデフォルトを削除します。

SQL0193N
In an ALTER TABLE statement, the column column-name has been specified as NOT NULL and    either the DEFAULT clause was not specified or was specified as DEFAULT NULL.

Explanation
When new columns are added to a table that already exists, a value must be assigned to that new column for all existing rows. By default, the null value is assigned. However, since the column has been defined as NOT NULL, a default value other than null must be defined.

User response
Either remove the NOT NULL restriction on the column or provide a default value other than null for the column.

sqlcode: -193

sqlstate: 42601

Parent topic: SQL Messages

メッセージトピック

于 2012-10-18T11:36:42.983 に答える