You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.
var x = Instant.FromUtc(2020, 7, 2, 0, 0).PlusTicks(1333333);
var y = x.ToDateTimeUtc();
var z = x.ToDateTimeOffset();
var aaa = conn.QuerySingle<Instant>("SELECT @x", new { x }); //2020-07-02 00:00:00.133
var bbb = conn.QuerySingle<Instant>("SELECT @y", new { y }); //2020-07-02 00:00:00.133
var zzz = conn.QuerySingle<Instant>("SELECT @z", new { z }); //2020-07-02 00:00:00.1333333
So precision is being lost somewhere in the round trip.
This might be due to the SqlParameter Precision and Scale properties.
Warning
Data may be truncated if the Scale property is not explicitly specified and the data on the server does not fit in scale 0 (the default).
For the DateTime2 type, scale 0 (the default) will be passed as datetime2(7). There is currently no way to send a parameter as datetime2(0). Scales 1-7 work as expected. This problem applies to DateTimeOffset and Time as well.
...Precision and Scale are required for output parameters...
The easiest way to reproduce this is as follows:
So precision is being lost somewhere in the round trip.
So precision is being lost when it's sent over to the database, but works fine when reading.
The text was updated successfully, but these errors were encountered: