I have the following query save as a named query in Ignition, and during a gateway event it is triggered in a script and is meant to flip a bit in a SQL table.
with CTE as
(SELECT top (3) BagProcessed
WHERE Dest_Type like '%Bag%' and BagProcessed not in (1) and Roaster_ID = 2
order by RoastDate asc, RoastTime asc)
CTE.[BagProcessed] = 1
When I run this query in SQL, it works as desired. When I try to run it in the Named Query test tab, I get the error "Index 2 out of range"