ModDBExport

Forum Home Forums Uncategorized Issues ModDBExport

Tagged: 

This topic contains 36 replies, has 3 voices, and was last updated by Mikhail Mikhail 4 months, 2 weeks ago.

Viewing 7 posts - 31 through 37 (of 37 total)
  • Author
    Posts
  • #5038
    Mikhail
    Mikhail
    Moderator

    but how to doit?

    See T-SQL manual. Also we can develop scripts for you for a fee.

    #5041
    Avatar
    aluy069
    Participant

    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?

    #5051
    Mikhail
    Mikhail
    Moderator

    An INSERT statement executes for each channel separately.
    That’s why the default expression is simple

    INSERT INTO CnlData (DateTime, CnlNum, Val, Stat)
    VALUES (@dateTime, @cnlNum, @val, @stat)

    You have to change it to executing a stored procedure. Example for Postgres
    SELECT my_schema.proc_cur_data(@cnlNum, @val, @stat);

    And then perform filtering in the stored procedure my_schema.proc_cur_data.

    #5076
    Avatar
    aluy069
    Participant

    Sorry but i dont know what you mean with “Example for Postgres”

    #5083
    Mikhail
    Mikhail
    Moderator

    I mean that the SQL syntax of my example is for Postgres.

    #5092
    Avatar
    aluy069
    Participant

    Mikhail

    Give me a quote to do the programation necesarely to:

    Send the data to SQL 2017 sever using db export to construct a table with the cnlnum I choose in the same line, also I beed timestamp and status

    The table headers in sql should look like:

    id | time | quality | oee | model | disp | stat

    I need when the dbexport send the data to sql send all colloms of the row at the same time
    tanks

    #5098
    Mikhail
    Mikhail
    Moderator

    Please write the request to info@…org and I will prepare a quote.

Viewing 7 posts - 31 through 37 (of 37 total)

You must be logged in to reply to this topic.