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.
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:
In my report I pass tags into parameters.
So, How can I update those parameters?
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”.
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.
Don’t know what type of database your using but I normally avoid text and use varchar. Would something like this work:
WHERE
CONVERT(VARCHAR, line) = 'Line 1'
AND
CONVERT(VARCHAR, Unw) = 'Unwinder 1'
I don’t know what “varchar” is, but thanks, it worked!
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.
1 Like
Thank you!
Do you know if I can update all my values at once with different value?
Something similar to this but functionnal?
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
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')
1 Like