-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass through full 7 d.p. precision of time, e.g. datetime2 type #519
Comments
We should follow SAP ABI, see https://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc20155.1550/html/newfesd/newfesd48.htm. Said that it does not mean we can't have some way to extend the behaviour somehow and have SQSH use this extension. But note that the precision of Sybase times (used by |
On the one hand the ABI seems to allow for different precisions. The field However, the ABI documentation you link specifies "For CS_BIGDATETIME and CS_BIGTIME, this field is always 10^6". To support the Microsoft-specific The more important question is whether the higher precision is even available to FreeTDS. If the TDS protocol itself is only sending down six decimal places, there's nothing to be done. |
Obviously the TDS protocol supports all digits. libTDS (the lower level library) uses a structure which is able to handle all precisions (that why it uses deci-microseconds that is 7 digits). But ctlib specifications are written for Sybase which support at maximum 6 digits precision, that's why the One easy way would be to have an option in ctlib to return |
Thanks, on revisiting Yes, passing as a string is an easy way out. When using Perl's DBD::Sybase you always get full precision for |
I am using FreeTDS with sqsh to connect to an MSSQL 2016 server. It supports a
datetime2
data type which has fractional seconds with 7 decimal places. I would like to get back all 7 d.p. on the client but values are returned from FreeTDS with only 6 d.p.(semi-informed speculation follows, since I am not a FreeTDS developer)
Although in
ctlib/cs.c
there are a couple of lines of code which convert from 7 to 6 d.p.I believe the real issue is somwhere in
tds/convert.c
where theSYB5BIGDATETIME
format is decoded. It appears that it comes back over the wire with only 6 d.p. Is that so? The code multiplies it by 10 and then divides by 10 later.Is there anything that can be done? All I can think of is to set
TDSVER
to an older level so that the server starts returning these values as strings (with full precision).The text was updated successfully, but these errors were encountered: