Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Re: DB Write with SQL

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

Bronze

Re: DB Write with SQL

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

Re: DB Write with SQL

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.

Bronze

Re: DB Write with SQL

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.

206
Views
10
Helpful
4
Replies
CreatePlease to create content