08-13-2009 02:13 PM - edited 08-13-2009 02:14 PM
I just realized there is a typo in that last statement. It should be:
SELECT DATEPART(ms,Start_Test_Time) FROM Engine_Tests
11-24-2011 07:39 AM
Matthew,
Many thanks for the great answer. Still a very usefull solution to get a dateTime -value or timestamp with milliseconds accuracy back into LabVIEW through the ADO driver (Database Connectivity Toolkit).
-Roger
07-06-2017 03:25 AM
I'm adding to this as I found this thread when trying to find a solution to import datetime2 formatted data from SQL into LabView. I believe this thread solution is great as long as log time is <1s, anything >1s then the received data could get confusing (maybe not to the programmer but to a third party).
For some reason, LabView Variant to data vi cannot interpret Datetime2 formatted data from SQL as time based. However it can happily interpret datetime formatted data, something I find most odd as datetime2 has been around since 2008!?
There are various part solutions available on the forum but I could not find an exact solution. One method found in the forums to set the type in variant to data as a String and then use scan from string vi to steer LabView to interpret the string as a time stamp. The key is, and this is where other posts have been misleading (to me as a beginner), the instruction in the format string constant.
Attached file, SQLdt2toTime.vi is a simple vi that should perform the conversion. There is also a screen shot of the calling vi so one can see how it is being used in context.
The relevance to this post is that the output builds an array where the 2nd column in this instance is time in ms but it could be as small as ns, useful for experiments with sampling periods >1s.