Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

'SQL Code' activity example


Level 2


Can someone please guide me how to use 'SQL Code' activity in Adobe Campaign with an example? A help in this regard will be highly appreciated.

2 Replies


Employee Advisor

Hi Manish,

The SQL Queries in the Workflow can be directly used in the JavaScript Activity.

The Syntax to do so is given below :

1. var sqlQuery=("Select iworkflowid, ifailed from xtkworkflow where sinternalname='abc''');

    var wfState=sqlSelect("publicUrl,@getWfID:int,@getWfFailedStatus:int",sqlQuery);


    Note # @getWfID -> getWfID is the variable name (anything you may give), and int is datatype of the value which will be returned            by SQL Query.

     Also, if you want to use this variable somewhere in your JS, then you may refer to this variable by below Syntax :


2. Or if you want to use the SQL Code activity to write the SQL Queries in the workflow, then you can use the below syntax:

   INSERT INTO nmsabc VALUES (1, 1, 'first' , 'OK', '2000-01-01 00:00:00+02', '2000-01-01 00:00:00+02', '2000-01-01 00:00:00+02');

3. Third option is that you can directly run the SQL Queries in Using The JavaScript activity by writing the below syntax in JS :

     sqlExec("update sbc set tspreviousruntime = '"+getDate()+"' where iid = '123'");