If you are unable to create a new account, please email support@bspsoftware.com

 

How to insert user defined variable values using a SQL Node?

Started by LEO, 11 Aug 2010 03:55:13 AM

Previous topic - Next topic

LEO

I have created a job stream...it has certain condition as well..have placed a sql node to insert/capture that variable value into database table...but unable to read the variable values in insert statement

i have mentioned the insert as below:

insert into x_dbvalues
values($chkVar,'s');

the values $chkVar is a texttype of column in table.

MFGF

To use a variable in a SQL node, you will need to include it in a pair of braces {} - ie

insert into x_dbvalues
values({$chkVar},'s');

Alternatively, do this from a Procedure Node using a SQL() function.

Regards,

MF.
Meep!

LEO

SQL() would help in such statements to run:

To run the below SQL statement
--------------
insert into x_dbvalues
values($chkVar,'s');
--------------
Use below code:

$QUERY := CONCAT('INSERT INTO x_dbvalues VALUES(','''',$chkVar,''',''s'')');
SQL('TARGET', $QUERY);

Use of {}, will result in substituting of default values assigned to the variable while inserting rahther than the changed value in variable.