Using Tags in Named Queries

I'm attempting to use a named query that will have a WHERE clause to delete certain rows from the database. I need my WHERE clause to reference a memory tag but I'm having no luck making the connection to a tag within the query Authoring or Testing. I've tried this and several other variations-

SELECT *

FROM TableName

WHERE ColumnName = [default]MemTags/LocationTag.value}

As far as I can tell, there is no way to look at a tag within the Names Queries. Am I missing something?
I've also started looking into Transaction Groups (SQL Bridge) as a solution to this, but so far that does not seem to be the solution to me 'simple' problem either.

Any insight that can be offered on how to check against tags when manipulating a database will be greatly appreciated. Thank you!

1 Like

You cannot directly reference a tag. Make a parameter to put in the query. Supply the tag value to the parameter when you call the named query.

2 Likes

I have parameters defined, but I'm not seeing how can supply a tag value to them. Thank you!
--Edit. Got it- Assigning the parameters in a script when calling the named query.
Thank you for the assistance!

3 Likes

How do you create a parameter to reference the memory tag to?

Named Queries that have parameters expect you to supply a dictionary of parameter values, using the parameter names as the keys (case sensitive). Make a dictionary containing your parameter values.

2 Likes