Hello,
I have a stored procedure where input parameters are being validated, in case one has an undesired value I use RAISERROR.
This is the SQL code:
IF @name IS NULL OR NULLIF(RTRIM(LTRIM(@name)), '') IS NULL
BEGIN
RAISERROR('Invalid parameter: @name cannot be NULL or empty.', 18, 0)
RETURN
END
Is it possible to read this error message?
This is my [simplified] code:
try:
call = system.db.createSProcCall(procedureName='save')
call.registerInParam('name', system.db.VARCHAR, None)
system.db.execSProcCall(call)
except java.lang.Exception:
/* This is where I would like to print the error raised by the stored procedure. */
print 'RAISERROR'
This is what I get when I run the stored procedure in SQL Server Management Studio:
Msg 50000, Level 18, State 0, Procedure save, Line 29
Invalid parameter: @name cannot be NULL or empty.
Please let me know if this is possible.
Thanks.