I couldn't look at your VI (7.0), but you can read (and change) the strings in a ring by using a property node.
To create one, right click on the control or the terminal and select Create>>Property Node. Then, click on the property and find Strings[] in the list. This is an array of all the strings in the ring. You can wire it, along with the ring value, into Index Array and you will get the string you chose.
You can now use this string to build your SQL query, no need for numbers and codes.
You can further customize this by using different strings for each field. For example, you can have one ring which will select the field, and based on that, another ring will now have only the values relevant to that field.
You can save these values in an array and that way have an unlimited query.
Correct me if I'm wrong, but don't the DB tools allow you to extract data directly (For instance, the DB Tools Select Data VI)? Shouldn't this allow you to extract all the info you need?
___________________
Try to take over the world!