Transaction Group DB to OPC SQL Query

I am having an issue with a transaction group triggered expression using a sql query. Below is my query, the item field is between 10 and 12 numeric characters. So I want to look at just the right 5 characters. The issue is if the first character of those 5 is a 0 the transaction group runs fine and outputs what I am looking for. If the first character is any other number than 0 it will not return the value. If I run this query using ‘35749’ instead of the tag it returns the correct field. The transaction group returns success when it completes but it doesn’t return anything, it keeps the last value. It will show that it executed but does not do a tag write.

SELECT TOP (1)
[Item]
FROM [Gateway_Prod].[dbo].[ItemInfo]
where right (Item, 5) = {[~]Concentrator/Poly1/poly1ItemInfo/itemLookup}

Put single quotes around the criteria.

Thank you, I didn’t realize I needed quotes around a tag, makes sense because it was looking at it as an integer instead of a string. I appreciate your time.

1 Like