freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] SQLBindParameter using TIMESTAMP_STRUCT: Fractional partis wrong
- From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] SQLBindParameter using TIMESTAMP_STRUCT: Fractional partis wrong
- Date: Tue, 8 Jan 2008 09:17:34 +0100
>
> I believe that the fractional part is wrong inserted when
> using the TIMESTAMP_STRUCT type:
>
> rcode = SQLBindParameter(m_hstmt1, 1, SQL_PARAM_INPUT,
> SQL_C_TYPE_TIMESTAMP,
> SQL_TYPE_TIMESTAMP, 23, 0,
> &v_ts, 0, &v_ts_ind);
>
> In ODBC, the "fraction" field of a TIMESTAMP_STRUCT
> represents a number of nanoseconds.
> -> The value for a half second would be 500,000,000.
>
> In Transact-SQL, datetime columns have fraction part
> expressed in milliseconds, with an
> accuracy of 3,33 milliseconds.
>
> So when inserting a datetime value with the string
> 'yyyy-mm-dd hh:mi:se.003', it means
> 3 milliseconds, which should be:
>
> 3 * 1000 * 1000 = 3,000,000 nanoseconds
>
> ... in a TIMESTAMP_STRUCT. Right?
>
> But when using this value in a TIMESTAMP_STRUCT binding, I
> get .000 in the database.
>
> Looks like the value is rounded before it is sent to the server...
>
> Note that the value of 18,000,000 nanoseconds (18
> milliseconds = .018) is rounded to
> .017 in the database (as expected)...
>
> See attached example to reproduce...
>
>
> Resources:
>
> http://msdn2.microsoft.com/en-us/library/ms714556.aspx
> http://support.microsoft.com/kb/263872
>
>
> Thanks
> Seb
>
Fixed. Was a rounding problem.
freddy77
-
[freetds] SQLBindParameter using TIMESTAMP_STRUCT: Fractional part is wrong,
Sebastien FLAESCH, 01/07/2008
-
Re: [freetds] SQLBindParameter using TIMESTAMP_STRUCT: Fractional partis wrong,
ZIGLIO, Frediano, VF-IT, 01/08/2008
-
Re: [freetds] SQLBindParameter using TIMESTAMP_STRUCT: Fractional partis wrong,
Sebastien FLAESCH, 01/08/2008
-
[freetds] SQLExecDirect() of transaction statement returns SQL_NO_DATA,
Sebastien FLAESCH, 01/08/2008
-
Re: [freetds] SQLExecDirect() of transaction statement returnsSQL_NO_DATA,
ZIGLIO, Frediano, VF-IT, 01/08/2008
-
Re: [freetds] SQLExecDirect() of transaction statement returnsSQL_NO_DATA,
Sebastien FLAESCH, 01/08/2008
-
[freetds] SQLNumResultCols() is wrong (+1),
Sebastien FLAESCH, 01/08/2008
- Re: [freetds] SQLNumResultCols() is wrong (+1), ZIGLIO, Frediano, VF-IT, 01/08/2008
- Re: [freetds] SQLNumResultCols() is wrong (+1), Frediano Ziglio, 01/10/2008
- Re: [freetds] SQLNumResultCols() is wrong (+1), ZIGLIO, Frediano, VF-IT, 01/10/2008
- Re: [freetds] SQLNumResultCols() is wrong (+1), Sebastien FLAESCH, 01/10/2008
-
[freetds] SQLNumResultCols() is wrong (+1),
Sebastien FLAESCH, 01/08/2008
-
Re: [freetds] SQLExecDirect() of transaction statement returnsSQL_NO_DATA,
Sebastien FLAESCH, 01/08/2008
- [freetds] Are LOBs supported?, Sebastien FLAESCH, 01/08/2008
-
Re: [freetds] SQLExecDirect() of transaction statement returnsSQL_NO_DATA,
ZIGLIO, Frediano, VF-IT, 01/08/2008
-
[freetds] SQLExecDirect() of transaction statement returns SQL_NO_DATA,
Sebastien FLAESCH, 01/08/2008
-
Re: [freetds] SQLBindParameter using TIMESTAMP_STRUCT: Fractional partis wrong,
Sebastien FLAESCH, 01/08/2008
-
Re: [freetds] SQLBindParameter using TIMESTAMP_STRUCT: Fractional partis wrong,
ZIGLIO, Frediano, VF-IT, 01/08/2008
Archive powered by MHonArc 2.6.24.