Using DB event

Error:

Process flow is being successfully triggered from DB trigger event. But the process flow is being aborted at the Source activity (database source)

Here is the error:

Error in execution for activity DatabaseSource:DB_Source:010010000111145581621672400138[Conversion failed when converting the varchar value ''@RecID'' to data type int.]

Here is the DB trigger definition within Adeptia

create trigger DB_Trigger on dbo.[Case_Data] for insert,update as declare @RecID varchar(20)
begin set @RecID=(select RecID from inserted); INSERT INTO dbeventtriggertable VALUES('Query = WHERE RecID =''@RecID'''); END ;

I tried to change the varchar(20) to INT. But it didn’t work. RecID is an INT column in the table.

 

Cause:

This error is occurring because @RecID is being parsed as a string instead of an integer.

 

Solution:

SQL Server 2012 or newer

create trigger DB_Trigger on dbo.[Case_Data] for insert,update as declare @RecID int
begin set @RecID=(select RecID from inserted); INSERT INTO dbeventtriggertable
VALUES(concat('Query = WHERE RecID = ',@RecID)); END ;

 

Older versions of SQL server

Will throw this error, since concat is not supported

Error in activating Database Event "DB_Event(010010000111145615511236800177)"com.adeptia.indigo.services.ServiceException: Error in EventScheduler service : Error while creating database trigger job : Error in creating trigger for database Event service 'concat' is not a recognized built-in function name.

So you'll need to use the following

create trigger DB_Trigger on dbo.[Case_Data] for insert,update as declare @RecID int
begin set @RecID=(select RecID from inserted); INSERT INTO dbeventtriggertable
VALUES('Query = WHERE RecID = '+ @RecID); END ;

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.