I have a stored procedure which is doing an insert into a table from a stored procedure.
create procedure spImportData
as
begin
begin try
insert into table (id, notes)
exec linkedserver.database.dbo.spGetData
end try
begin catch
select error_number(), error_state(), error_message()
end catch
end
What I found is this, if I run the stored procedure, it returns an error message
Msg 0, Level 11, State 0, Line0
A severe error occurred on the current command. The results, if any should be discarded.
If I however remove the try and catch blocks. it reveals the actual error which in this case is a truncation error.
Msg 8152, Level 16, State 2, Line 1
String or binary data would be truncated.
I am wondering why is the try and catch not returning the correct meaningful error message
SQL version is SQL 2014.