SQL 髢「謨ーシ壹す繧ケ繝繝髢「謨ー

蟄伜惠繝√ぉ繝繧ッ


IF OBJECT_ID( 'dbo.TestTable', 'U') IS NOT NULL
縲縲DROP TABLE TestTable;
CREATE TABLE TestTable
(
縲縲ス
);

譖エ譁ー縺輔l縺溯。梧焚繧貞叙蠕

IF @@ROWCOUNT = 0
PRINT '繧ィ繝ゥ繝シ繝。繝繧サ繝シ繧ク';

繧ィ繝ゥ繝シ譎ゅョ蛟、

BEGIN TRY
縲縲ス
END TRY

BEGIN CATCH
縲縲SELECT
縲縲縲縲繧ィ繝ゥ繝シ蜀螳ケ繧定。ィ縺咏分蜿キ
縲縲縲縲ERROR_NUMBER() AS ErrorNumber,
縲縲縲縲
縲縲縲縲繧ィ繝ゥ繝シ縺檎匱逕溘@縺溘せ繝医い繝牙錐/繝医Μ繧ャ繝シ蜷咲ュ
縲縲縲縲ERROR_PROCEDURE() AS ErrorProcedure,
縲縲縲縲
縲縲縲縲繧ィ繝ゥ繝シ縺檎匱逕溘@縺溯。
縲縲縲縲ERROR_LINE() AS ErrorLine,
縲縲縲縲
縲縲縲縲繧ィ繝ゥ繝シ繝。繝繧サ繝シ繧ク
縲縲縲縲ERROR_MESSAGE() AS ErrorMessage;
縲縲縲縲
END CATCH;

Follow me!

谺。縺ョ險倅コ

SQL 髢「謨ーシ壼、画鋤髢「謨ー