Hi
The procedure I posted is correct, but will compile only in Sql Server 2012 or above. You are probably testing on an older version. Try with RAISERROR (instead of THROW) :
CREATE PROCEDURE p_test
AS
DECLARE @err AS VARCHAR(100);
BEGIN
SET @err = 'test';
RAISERROR (@err , -- Message text.
16, -- Severity.
1 -- State.
);
END;
GO
Thanks for looking into this. I get the following output error:
Exception in Task: System.Data.SqlClient.SqlException (0x80131904): test
at OBOKIIHBDBPMCFALPGECCIFHCDJPEDKODDGK.NFMCAMDOGBCBCKKAEOJICMPGMOLBJPKAAHOI.BPNKNPGIMAAAJCHDLKLMKPOLKDLBPDDAPBLF(TaskProcessClass , Boolean& , ConnectionClass , Boolean , String , Int32 , CommandType , Boolean , String , List`1 lstParameters, StringBuilder& , StringBuilder& , VariableReplacerClass , JobClass , TaskClass , TriggerClass , SqlCommand& , TaskSQLOutputSettingsClass ) in C:\sourcefiles\code\VisualCronService\apiSQL.vb:line 1142
at OBOKIIHBDBPMCFALPGECCIFHCDJPEDKODDGK.GKHJKBDAJKKLOCDAGMDEFBPILHJMKGOIPBBJ.Run() in C:\sourcefiles\code\VisualCronService\Jobs\TaskProcesses\Database\clsProcessTaskSQL.vb:line 74
ClientConnectionId:82d1a460-7d8c-4259-b372-24c61dbd24a7