Hi all,
Some of the raise error messages inside the triggers are not being displayed in the DataWindow Error messageboxes.
In those cases, the DataWindow Error messagebox comes with the SQLState code, the "No changes made to the database" and the SQL Statement but misses the error text.
This causes frustration because the users do not know why their action was rolled back.
If I execute the actual sql statement of the action inside SQL Management Studio, I get the message fine.
I will give you code examples in case you can help me with this
(using SQL Server 2008R2 and PB 11.5)
--Trigger code
..
IF @status < 0
BEGIN
exec raise_message 60004
RETURN
END
..
-- Procedure code : raise_message
CREATE PROCEDURE dbo.raise_message @message_code int
WITH ENCRYPTION AS
DECLARE @language_code char(2), @message_text char(80)
SELECT @language_code = language_code
FROM session_info
WHERE process_id = @@spid
SELECT @message_text = message_text
FROM system_messages
WHERE message_code = @message_code
AND language_code = @language_code
ROLLBACK TRAN
RAISERROR(@message_text,10,1)
go
Any help appreciated!