'SQL Code' activity example

Avatar

Avatar
Validate 1
Level 2
manishc97360515
Level 2

Like

1 like

Total Posts

17 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
manishc97360515
Level 2

Like

1 like

Total Posts

17 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
manishc97360515
Level 2

20-03-2018

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.

Replies

Avatar

Avatar
Boost 50
Employee
shrawans3153003
Employee

Likes

69 likes

Total Posts

150 posts

Correct reply

66 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Boost 50
Employee
shrawans3153003
Employee

Likes

69 likes

Total Posts

150 posts

Correct reply

66 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile
shrawans3153003
Employee

20-03-2018

HI Manish,

You can go through similar thread on SQL code.

Re: SQL Code

Avatar

Avatar
Validate 1
Level 3
kapilsharma0101
Level 3

Likes

14 likes

Total Posts

52 posts

Correct reply

18 solutions
Top badges earned
Validate 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Validate 1
Level 3
kapilsharma0101
Level 3

Likes

14 likes

Total Posts

52 posts

Correct reply

18 solutions
Top badges earned
Validate 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
kapilsharma0101
Level 3

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