Here is my insert stored procedure:
CREATE PROCEDURE spainsert
@A_Name nvarchar(50)
AS BEGIN
BEGIN TRY
DECLARE Detailed_Error VAR_CHAR(MAX);
Insert into A(A_Name)
values(A_Name)
END TRY
BEGIN CATCH
SELECT
Detailed_Error = CAST(ERROR_NUMBER() AS VAR_CHAR ) + ' : '+ ERROR_MESSAGE() + ' : ' + CAST(ERROR_LINE() AS VAR_CHAR );
END CATCH
END
When I try to enter NUMBER instead of NAME : exec spa insert 500, it won't show any error, but just saves that row into table. Could you please help me how to handle errors, how to know the number and the error message ?!
Thank you all ! 123456787523535464654645654651541541255435.4153241653241636524165324135
Aucun commentaire:
Enregistrer un commentaire