SQL Server jdbc - Time, milliseconds and microseconds.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I have a sql query and everything works fine, but matlab during the import lose all the numbers after the seconds. Inside the DB I have 7 numbers after the seconds that are complitely lost in Matlab.
SQL --> 07:55:04.1621280
MATLAB--> 07:55:04
I have attached two screen shots, one from the DB and one frome the "CURS" in ML.
Could anyone give me any suggestion on how can I keep all the microseconds?
This page gave me some information but is not usefull for SQL:
Many thanks
s
0 Commenti
Risposte (1)
the cyclist
il 4 Set 2017
Are you sure it is not just an issue with how the number is being displayed? It may have the full precision.
I generally return data in cell array format, and have no problem. Perhaps try that?
5 Commenti
Manuel Dias
il 16 Nov 2017
Modificato: Manuel Dias
il 16 Nov 2017
Hi i stumbled at the same difficulty and i found one way to pass it. Use
Select time_collumm, DATEPART( millisecond,time_collum) as milliseconds from table_name
This will import to matlab a table with 2 collums. One with hh:mm:ss and the other with milliseconds. Now just convert the milliseconds to char and then add to the time part.
If you need more information about this solution you can find it here: https://docs.microsoft.com/en-us/sql/t-sql/functions/datepart-transact-sql
the cyclist
il 16 Nov 2017
Interesting idea. Along these lines, you could also perform the character concatenation within the SQL query itself, and just return the one column you need. (In postgres you concatenate with .)
Vedere anche
Categorie
Scopri di più su Data Type Conversion in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!