Filter a SQL query with variables from a previous one in Node Red

Hello all,

I try to query one SQL database in a Node Red flow to extract a few fields and declare them as variables, then re-use them to filter a second SQL query from another database.

I want to put the two msSQL nodes consecutively, without using flow variables.

example:
1st query:
"DECLARE @N_1Shift VARCHAR;
SELECT TOP (1)
@N_1Shift = [ShiftNo]
FROM db1"

2nd query:
"DECLARE @N_1Shift VARCHAR;
SET @N_1Shift = '{{msg.payload.N_1Shift}}'
SELECT TOP(1)
[ShiftStart]
FROM db2
WHERE [ShiftNo] = @N_1Shift"

Do you know what is not working here? I tried both '{{ }}' and '{{{ }}}'