I'd make the NQ parameter a bigint and convert to UTC milliseconds before the NQ.
Pssst! Why are you directly querying the historian's tables? That is a snake pit of complexity you should avoid (by using Ignition's tag history functions).
Not sure why, I just tested it and it works just fine for me with the exact same setup.
I do notice your start date is set in the future though, but I do not believe that would cause that error.
You didn't respond to Phil's question about why you are querying a history table directly. The built-in Tag History binding feature will get you what you want and sort out all the table partitioning behind the scenes.
Can you explain why you are writing your own query?
Sorry for the late reply,
I am using MySQL Workbench 8.0.33
For below issue I am trying to find a solution.
I was thinking of creating 2 tags for same variable, 1 for reading and 1 for writing and while saving the data in to the database I will have 2 tagID, for this reason I am trying to find a way like this.