# Query parameters update

**URL:** <https://forum.inductiveautomation.com/t/query-parameters-update/52309>\
**Category:** Ignition\
**Created:** [October 25, 2021, 6:50pm UTC](https://forum.inductiveautomation.com/t/query-parameters-update/52309 "2021-10-25T18:50:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![laurie.croteau](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@laurie.croteau](https://forum.inductiveautomation.com/u/laurie.croteau)\
**Post date:** [October 25, 2021, 6:50pm UTC](https://forum.inductiveautomation.com/t/query-parameters-update/52309/1 "2021-10-25T18:50:12Z")

</div>

I have create a named querie to put in a table in a report. I’m passing in parameters values of important tags to put into the report. The basic value of those is 0.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/9/096948e2ee285dead42c49d1d79162a37d9f26d8.png)

I’m trying to update data so my report will show values at the time the report is generate but I got an error when I try to execute Query in testing tab. This is the error:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/e/0e169d1e51f255522bf7642f171adb1dc9c4d03e.png)

In my report I pass tags into parameters.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/3/c34b086d33c2da464563ab8354e47e2c81419d0b.png)

So, How can I update those parameters?

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [October 25, 2021, 6:58pm UTC](https://forum.inductiveautomation.com/t/query-parameters-update/52309/2 "2021-10-25T18:58:42Z")

</div>

Your doing an update query but your first screen shot shows you have your query type set to query, try changing it to “Update Query”.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/f/9fb293326fd237e75ea7f308788a8732c398173d.png)

---

<div class="post-metadata">

**Author:** ![laurie.croteau](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@laurie.croteau](https://forum.inductiveautomation.com/u/laurie.croteau)\
**Post date:** [October 25, 2021, 7:00pm UTC](https://forum.inductiveautomation.com/t/query-parameters-update/52309/3 "2021-10-25T19:00:36Z")

</div>

That’s my bad! I switch between updating my querie and select my querie so I often forget to change it back. But my error stay the same.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/e/9eb7ed4bb4e3b0ce42517e10f66f28e5114a3712.png)

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [October 25, 2021, 7:06pm UTC](https://forum.inductiveautomation.com/t/query-parameters-update/52309/4 "2021-10-25T19:06:15Z")

</div>

Don’t know what type of database your using but I normally avoid text and use varchar. Would something like this work:

```auto
WHERE
	CONVERT(VARCHAR, line) = 'Line 1'
	AND
	CONVERT(VARCHAR, Unw) = 'Unwinder 1'

```

---

<div class="post-metadata">

**Author:** ![laurie.croteau](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@laurie.croteau](https://forum.inductiveautomation.com/u/laurie.croteau)\
**Post date:** [October 25, 2021, 7:07pm UTC](https://forum.inductiveautomation.com/t/query-parameters-update/52309/5 "2021-10-25T19:07:43Z")

</div>

I don’t know what “varchar” is, but thanks, it worked!

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [October 25, 2021, 7:10pm UTC](https://forum.inductiveautomation.com/t/query-parameters-update/52309/6 "2021-10-25T19:10:54Z")

</div>

Their both data types in your database. Text uses up its max space every time you create something with it where varchar can be set for a number of characters that it can use. If your setting up the database tables, I’d do a quick search on the two types to get a feel for their pros and cons.

---

<div class="post-metadata">

**Author:** ![laurie.croteau](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@laurie.croteau](https://forum.inductiveautomation.com/u/laurie.croteau)\
**Post date:** [October 25, 2021, 7:12pm UTC](https://forum.inductiveautomation.com/t/query-parameters-update/52309/7 "2021-10-25T19:12:31Z")

</div>

Thank you!  
Do you know if I can update all my values at once with different value?  
Something similar to this but functionnal?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/0/f0fb83ecf0a7ae6c47c0aac2d1c8614eaa4c7102.png)

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [October 25, 2021, 7:23pm UTC](https://forum.inductiveautomation.com/t/query-parameters-update/52309/8 "2021-10-25T19:23:40Z")

</div>

I can’t think of an easy way, you could probably use a “CASE” statement for your parameter that your bringing but that’s the only thing I can think of. I’ll be the first to say I’ve never tried it so don’t know if it will work.

something like

```auto
UPDATE
	line_Unw_Report
SET
	EndDiameter = CASE
						WHEN CONVERT(VARCHAR, line) = 'Line 1' AND CONVERT(VARCHAR, Unw) = 'Unwinder 1' THEN :End_Diameter_L1_U1
						WHEN CONVERT(VARCHAR, line) = 'Line 1' AND CONVERT(VARCHAR, Unw) = 'Unwinder 2' THEN :End_Diameter_L1_U2
						ELSE Null
					END
WHERE
	(CONVERT(VARCHAR, line) = 'Line 1'
	AND
	CONVERT(VARCHAR, Unw) = 'Unwinder 1')
	OR
	(CONVERT(VARCHAR, line) = 'Line 1'
	AND
	CONVERT(VARCHAR, Unw) = 'Unwinder 2')

```
