Quantcast
Channel: SCN : All Content - PowerBuilder Developer Center
Viewing all articles
Browse latest Browse all 2935

SQL Server raise error in triggers not shown in DW error msgbox

$
0
0

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!


Viewing all articles
Browse latest Browse all 2935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>