Insert SQL with parameters, named query, ERROR

I created a named query
INSERT into Alarm_log1 (eMsg, eSubject, Emaildest, Reaction_code, Alarm_type, Oven, wireline) VALUES (:pMsg, :eSub, :emailDest, :ReactCode, :AlarmType, :Oven, :Wireline)

but when I try to run it from the TESTING tab it returns the next error
com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ‘:’.

as I see in the documentation this is the right way to call the parameters, so I am not sure what can be the error, help welcome.

Are all your parameter types correct? If you have a string parameter but it should be an integer I think Ignition would be surrounding it with quotes but then your db will complain. Double check your parameter types.

Also goes without saying but make sure the named query type is an Update query (though I don’t think that is the problem here).

Solved, not sure what was the Error because I just retype the query and it worked.
thanks

1 Like

One thing I’ve noticed with name queries is I need to get out of the tab where you edit them and then save the project to make it take. I’ve had the issue a few times where I edit a named query and thought I saved it and it was in the project but it was not. The most surefire way I’ve found is edit the NQ, get out of it, then save the project and make sure that it is no longer italicized in the project browser.

thank you