I have two tables and a simple stored procedure. I want to use the stored procedure to insert into table1 with one of the parms being the primary key.
Here is where I am having trouble:
I want to have it so that if the parm/primary key the user has entered into the stored procedure and run is already on the table then it writes out the fields to a second table as well as the error description.
How do you capture / output this error information?
Stored procedure (sans the error logging):
CREATE PROCEDURE procedure1 @Primary INT, @Info NVARCHAR AS BEGIN SET NOCOUNT ON INSERT INTO Table1 ( Primary , Info ) VALUES ( @Primary , @Info ) END