Insert tag into a tag query where clause?

How do I insert a tag into where clause when creating tag query? I insert it but keep getting an expression error?

SELECT SUM(Duration)
FROM Table
WHERE Column1 = {[.]Description1} AND Column2 = {[.]Description2} AND WorkingDate = CAST( GETDATE() AS Date )

Hi Ly17,

What version of Ignition are you using? Just to clarify, you are writing this query in a query tag right? Where do you see the error and what exactly does it say?

When you are writing the query, it is suggested you use the Insert Tag button on the right side of that box. Is that what you used?

Tag insertion with curly braces performs a string substitution into the SQL without regard for the structure of the query. You will need single quotes enclose any non-numeric substitutions, possibly with manual casting, and may need intermediate tags for character escaping.

Instead of using a query tag, consider using a memory tag, then use a timer script at the same pace to execute your query with one of the scripted forms that handle parameters for you. Write the return value from system.db.runPrep*() and/or system.db.runNamedQuery() to your memory tag.

Thanks. That fixed the problem once I included single quotes.

That's an interesting alternative. I'll keep that in mind. Thanks.

Wait until someone puts a single quote in either description tag.

In other words, it isn't just an alternative. It is a substantially more robust approach.