# Tag Query - Getting String Values using Tags as Parameters

**URL:** <https://forum.inductiveautomation.com/t/tag-query-getting-string-values-using-tags-as-parameters/87753>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [March 22, 2024, 3:56pm UTC](https://forum.inductiveautomation.com/t/tag-query-getting-string-values-using-tags-as-parameters/87753 "2024-03-22T15:56:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Don\_Louie\_Nikko\_Coll](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/don_louie_nikko_coll/32/59882_2.png) [@Don\_Louie\_Nikko\_Coll](https://forum.inductiveautomation.com/u/Don_Louie_Nikko_Coll)\
**Post date:** [March 22, 2024, 3:56pm UTC](https://forum.inductiveautomation.com/t/tag-query-getting-string-values-using-tags-as-parameters/87753/1 "2024-03-22T15:56:25Z")

</div>

I have this SQL scalar function on a Query tag which has the parameters @location and @level.

I have these tags called:

1. location (as memory tag string) - with the value '0788'
2. level - as float

my query tag contains the query:

```auto
DECLARE @location VARCHAR(50) = CONVERT(VARCHAR(50), {[.]../location.value});
DECLARE @Level FLOAT = {[.]../level.value};
SELECT dbo.fx_CalculateVolume(@location, @Level);

```

which basically grabs the tag values and use it as a parameter to the function. But I am receiving a NULL value.

But when I try this:

```auto
DECLARE @location VARCHAR(50) = '0788'
DECLARE @Level FLOAT = {[.]../level.value};
SELECT dbo.fx_CalculateVolume(@location, @Level);

```

I am getting a returned value. I was wondering if there is something I'm missing or a property from ignition from the conversion to string using the tag value.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [March 22, 2024, 4:16pm UTC](https://forum.inductiveautomation.com/t/tag-query-getting-string-values-using-tags-as-parameters/87753/2 "2024-03-22T16:16:24Z")

</div>

> [@Don\_Louie\_Nikko\_Coll](#):
>
> `DECLARE @location VARCHAR(50) = CONVERT(VARCHAR(50), {[.]../location.value})`

try single quotes around it?

`DECLARE @location VARCHAR(50) = 'CONVERT(VARCHAR(50), {[.]../location.value})'`
