i performed in SQL 2017
——————-
SELECT [DateTime],
case when cnlnum = 22 then val else 0 end as Modelo,
case when cnlnum = 26 then val else 0 end as Q,
case when cnlnum = 29 then val else 0 end as Efici,
case when cnlnum = 30 then val else 0 end as Disp,
case when cnlnum = 32 then val else 0 end as Turno,
case when cnlnum = 58 then val else 0 end as OEE,
case when cnlnum = 65 then val else 0 end as Run,
Stat
FROM CnlData
where CnlNum in (22,29, 30, 26,58,32,65) AND stat = ‘1’
—————–
it almost do what i need from SQL server but, i just need to send those CnlNum (22,29, 30, 26,58,32,65) to the SQL2017 instead all values cor CnlNum.
I need to do something in the SCADA server like this:
———-
— Insert current data CnlDataLS
INSERT INTO CnlDataLSt (DateTime, CnlNum, Modelo, Calidad, Eficiencia, Disp, Turno, OEE, Run, Stat)
VALUES (@dateTime, @cnlNum, @Val(22), @Val(29), @Val(30), @Val(26), @Val(58), @Val(32), @Val(65), @stat)
——–
my question in what should be the arguments for “INSERT INTO CnlDataLSt” and “VALUES”
May I explain myself?