SQL Query error with OPC tag?

Hey all, newbie here. I’m having trouble with a SQL query giving me an error. The error I’m having is when I press “OK” after editing the label that has the SQL Query in it, it gives me an error and it says there is an incorrect syntax next to my ‘AND’. Which is just to the right of my OPC tag. But for some odd reason, it wipes out my OPC tag like it’s not even there. Now I have this same exact code, just different device (so different tag) working on another label. Can someone help me on where I may have messed up creating the other device? I’m assuming that’s why it’s wiping out that tag.

The devices I’m using are badge scanners over the TCP Drivers and I’m using ignition to search the database, the database then sends what it finds to a AB PLC. All that works great. It’s just two badge scanners that are giving me fits.

Any help is greatly appreciated.

Thank you,
W

We can’t possibly help you diagnose the syntax error if we can’t see the syntax.

If you can’t post the syntax publicly then I would recommend getting support on the line.

All of that being said, it sounds like you’re not using a named query? What version of Ignition are you using? If 8+ are you using the Vision or Perspective module?

Hey there,
I’ve got a picture of the code, just not the error. If this is any help.

The OPC Tag to the left of the AND just disappears after hitting ok and the error says something along the lines of Syntax error has occurred near ‘AND’.

What is the type of the column CredentialNo?

I don’t have Ignition 7, so I don’t have the ability to test this, but perhaps the TagPath isn’t valid because it doesn’t include the provider? However, I don’t remember if that actually matters in this case.

I would suggest though that you use a Named Query, as I think it would make this simpler.

So, I just got back onto the customers server and had him test out the badge scanners and it just started working. I think the tag from the scanner needed something in it for the SQL code to be happy I guess. Don’t know why it would work that way but hey, it works so I’m not complaining.

Thank you for taking time out of your day to help out. Really appreciate it.

Have a good one!