creating and populating the test table
declare @jj nvarchar(MAX) = N'[
{"text":"10","f_date":"1/11/20"},
{"text":"11","f_date":"1/11/21"},
{"text":"12","f_date":"1/11/22"}]';
select * into tt from OPENJSON(@jj) with ([text] nvarchar(50),f_date smalldatetime)
here is the stored procedure
CREATE or alter PROCEDURE PTest
-- Add the parameters for the stored procedure here
--@Param1 int = 0
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SELECT * from ttable
RAISERROR (N'Message %s', -- Message text.
10, -- Severity,
1, -- State,
N'first'
)
with nowait;
SELECT * from ttable
RAISERROR (N'Message %s', -- Message text.
10, -- Severity,
1, -- State,
N'second'
)
with nowait;
END
GO
the question is:
how to transfer error (noncritical) using RAISERROR or something else, to the C# code and handle it without interrupting the stored procedure
What I have tried:
MSDN, C#, Transact-SQL, .NET, Microsoft SQL Server