QueryTag Query is failing

I have a query that works fine in MSSQL, when i put it into a QueryTag using tags or with hard coded values it fails. I didnt see anything in the docs so I was hoping someone could shed some light, thanks!

This fails in a Query Tag

SELECT ur.rollID FROM upe_rolls AS ur INNER JOIN upe_lot_numbers AS uln ON uln.lotNumID = ur.lotNumID WHERE uln.lotNumber = 'LOTTEST3' AND ur.rollNum = 1

This fails in a Query Tag

SELECT ur.rollID FROM upe_rolls AS ur INNER JOIN upe_lot_numbers AS uln ON uln.lotNumID = ur.lotNumID WHERE uln.lotNumber = '{[.]E1_LotNum_1}' AND ur.rollNum = {[.]E1_RollNum_1}

but it works fine in MSSQL, any ideas? Thanks

Right-click on the Tag and check out its Tag Diagnostics:

Thanks! I don’t know how I missed that option!

It said I did not have a default database selected. But… Default was selected and that is what the rest of the app is using, either way. I made the change and its working now, thanks!

Tags cannot have a default database connection because they are shared by projects. Client tags are an exception.

Thanks for the clarification, now it makes sense!

Hi,

That answer is half correct. They’re not in a project, so they don’t share the project’s default. However, it is possible to set a “default” connection if you log into the gateway, and go to SQLTags>Realtime, and edit the provider.

Anyhow, glad you got it working.

Regards,