What is an equivalent sql query for the below Excel add-in functions PICalcVal(Tagname,begin time, end time, "average", 1, 0,"server1") PIAdvCalcDat(Tagname,"y","t","15m","average (time-weighted)&quo

We would like to use the sql query to generate data in our reporting tool.

Parents
  • Hello,

    Thank you for the information you have provided. Per your suggestion I tried to execute the below query

    SELECT *

    FROM PI.PIArchive..piavg t1

    WHERE t1.tag = 'tagname'  

    AND t1.time BETWEEN '12-Jun-2023 00:00:00' AND '13-Jun-2023 00:00:00'

    AND t1.timestep = '15m'

    and t1.pctgood >=100 ;

    I am getting the below error.

    "Conversion failed when converting date and/or time from character string."

    Please let me know how to fix this error.

     

     

Reply
  • Hello,

    Thank you for the information you have provided. Per your suggestion I tried to execute the below query

    SELECT *

    FROM PI.PIArchive..piavg t1

    WHERE t1.tag = 'tagname'  

    AND t1.time BETWEEN '12-Jun-2023 00:00:00' AND '13-Jun-2023 00:00:00'

    AND t1.timestep = '15m'

    and t1.pctgood >=100 ;

    I am getting the below error.

    "Conversion failed when converting date and/or time from character string."

    Please let me know how to fix this error.

     

     

Children
No Data