'SQL Code' activity example | Community
Skip to main content
Level 2
March 21, 2018

'SQL Code' activity example

  • March 21, 2018
  • 2 replies
  • 6671 views

Hi,

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

ShrawanSaxena-1
Adobe Employee
Adobe Employee
March 21, 2018

HI Manish,

You can go through similar thread on SQL code.

Re: SQL Code

Kapil_Sharma_
Adobe Employee
Adobe Employee
March 21, 2018

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 :

     wfState.publicUrl.@getWfFailedStatus

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'");