2

Very quick and simple question. I am running a script to import data and have declared a temp table and applied check constraints to that table. Obviously if the script is run more than once I check whether the temp table already exists and if so, I drop and recreate the temp table. would that also drop and recreate the check constraints I placed on the temp table?

Logic says yes but I have been known to be wrong about such things.

4

2 に答える 2

2

Yes - dropping the temp table will drop any internal dependencies as well, including your constraints.

于 2009-07-29T05:11:29.693 に答える
1

はい、テーブルを削除すると、テーブルに作成した可能性のある制約やインデックスなどが削除されます。

また、これを繰り返し実行している場合は、ドロップ/再作成するのではなく、切り捨てることができます。これは通常、はるかに高速です。(場合によっては、「永続的な」一時テーブルを作成することは、頻繁に発生する操作に適している場合があります)

于 2009-07-29T05:13:30.440 に答える