Please help. I'm stumped.
I need to create a dynamic variable in a procedure that will be used
to update a variable of the same name in a table. i.e. the name in
tblAnalysisScor es are WEAQScore0, WEAQScore1,WEAQ Score5, MissingWEAQ0,
MissingWEAQ1, MissingWEAQ5
The 0, 1, 5 are the @Interval. I am using a cursor to loop through the
table. Each row in the table is the data for one person at a given
timepoint (0,1,5).
This is what I have so far, but it doesn't recognize the concatenated
name as the name in the table.
What is the correct syntax to reference the variable?
In the code before this, I have already calculated @WEAQScore for the
current record of data. Now I want to update the correct variable in
tblAnalysisScor es
UPDATE tblAnalysisScor es SET
-- WEAQ Summmary/Missing
'WEAQScore'+ cast(@Interval as char(1)) = @WEAQScore
,'MissingWEAQ' + cast(@Interval as char(1)) = @MissingWEAQ
WHERE
SubID = @SubID
I need to create a dynamic variable in a procedure that will be used
to update a variable of the same name in a table. i.e. the name in
tblAnalysisScor es are WEAQScore0, WEAQScore1,WEAQ Score5, MissingWEAQ0,
MissingWEAQ1, MissingWEAQ5
The 0, 1, 5 are the @Interval. I am using a cursor to loop through the
table. Each row in the table is the data for one person at a given
timepoint (0,1,5).
This is what I have so far, but it doesn't recognize the concatenated
name as the name in the table.
What is the correct syntax to reference the variable?
In the code before this, I have already calculated @WEAQScore for the
current record of data. Now I want to update the correct variable in
tblAnalysisScor es
UPDATE tblAnalysisScor es SET
-- WEAQ Summmary/Missing
'WEAQScore'+ cast(@Interval as char(1)) = @WEAQScore
,'MissingWEAQ' + cast(@Interval as char(1)) = @MissingWEAQ
WHERE
SubID = @SubID
Comment