# SQL Syntax error

**URL:** <https://forum.inductiveautomation.com/t/sql-syntax-error/4770>\
**Category:** Ignition\
**Created:** [July 5, 2012, 4:06pm UTC](https://forum.inductiveautomation.com/t/sql-syntax-error/4770 "2012-07-05T16:06:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlr573](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@jlr573](https://forum.inductiveautomation.com/u/jlr573)\
**Post date:** [July 5, 2012, 4:06pm UTC](https://forum.inductiveautomation.com/t/sql-syntax-error/4770/1 "2012-07-05T16:06:07Z")

</div>

[code]param1 = event.source.parent.getComponent(‘Container’).getComponent(‘Group’).getComponent(‘lblJobNumber’).text  
param2 = results

system.nav.openWindow(‘Popups/Create New Wroker Order’, {‘jobNumber’ : param1})  
system.nav.centerWindow(‘Popups/Create New Wroker Order’)

results = system.db.runPrepQuery(“SELECT COUNT(“work\_order\_number”) FROM work\_order WHERE job\_id LIKE ?”, [param1])[/code]

Error:

Unable to register action actionPerformed  
Parse Error:  
SyntaxError: (“no viable alternative at input ‘work\_order\_number’”, (’’, 13, 48, ‘results = system.db.runPrepQuery(“SELECT COUNT(“work\_order\_number”) FROM work\_order WHERE job\_id LIKE ?”, [param1])\n’))

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [July 5, 2012, 4:15pm UTC](https://forum.inductiveautomation.com/t/sql-syntax-error/4770/2 "2012-07-05T16:15:32Z")

</div>

Check your spelling. You have two lines where Worker is spelled Wroker

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [July 5, 2012, 5:25pm UTC](https://forum.inductiveautomation.com/t/sql-syntax-error/4770/3 "2012-07-05T17:25:19Z")

</div>

```auto
results = system.db.runPrepQuery("SELECT COUNT("work_order_number") FROM work_order WHERE job_id LIKE ?", [param1])
```

Can you have quotes inside of quotes? I don’t think you can in this case… This may be your issue as well.

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [July 5, 2012, 5:28pm UTC](https://forum.inductiveautomation.com/t/sql-syntax-error/4770/4 "2012-07-05T17:28:16Z")

</div>

Good catch.
