I have an Excel worksheet that I have the data pulled from a Historian database for emission tags in a Wonderware server. I need to know how i can write the SQL query that uploads data between two date ranges.starte date end date.
I have collected the data and display I want, I just dont know how I can implement between two date ranges the user types in on another form. I DONT KNOW HOW TO DO THIS.
I have tried nothing because im not sure how to implement a parameter query with excel.
SET QUOTED_IDENTIFIER OFF
SELECT * FROM OPENQUERY(INSQL, "SELECT DateTime, [AB01_PE01], [NU_DC01_DX01_DISPLAY],
[NU_DC01_DX02_DISPLAY], [NU_DC02_DX01_DISPLAY], [NU_DC02_DX02_DISPLAY],
[NU_DC03_DX01_DISPLAY], [NU_DC03_DX02_DISPLAY], [NU_DC05_DX01_DISPLAY]
FROM WideHistory
WHERE wwRetrievalMode = 'Cyclic'
AND wwCycleCount = 14
AND wwVersion = 'Latest'
AND DateTime >= '20190501 06:00:00.000'
AND DateTime <= GetDate()")
what I want is where Datetime >= is I need to set up where it ask the user the start date and end date? I do not know how to do this in excel I am new to the historian add in.