cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
546
Views
10
Helpful
4
Replies

DB Write with SQL

Hi all,

I have problem with DB Write in CRA Editor

I can insert data in table in SQL server with this command

INSERT INTO table1(SDT) VALUES (123)

after run script, i see 123 is appeared in table1

But when i create variable X (interger ) with value=123 and using command

INSERT INTO table1(SDT) VALUES(@X)

i test and see 0 row is altered. And after run script, no thing appeared in table1

Thanks first

Please reply as soon as possible.

I will vote 5 * for you.

4 Replies 4

Any one can help me to use variable in SQL query in DB Write??

I think your problem is because you're using "@" instead of "$". Here is an example from one of my script:

INSERT INTO StatMenu(SessionID,DateTime,Choice) VALUES ($lCurrentSessionID,$strCurrentDateTime,'M1000')

There are two variables (String) and one hard-coded value ('M1000').

Hope this help !

Steven

Thanks Steven,

But when i use "$" instead of "@":

INSERT INTO table1(Number) VALUES($x);

I see this error when test this SQL command by click Excute button ont tab "Test"

" Test SQL Execution

Remote Error:Java.lang.NullPointerException

"

Hope you can help me.

It's probably because at the time you clicked the "Execute" button, the value of the "x" was null.

Anyway, I never use this button. Try with a real call or with reactive debugging. It should work just fine.