On Thu, 20 Mar 2014 03:07:39 -0700 (PDT)
Maksym Puzin <
mge...@gmail.com> wrote:
[...]
> > > *SQLExecute: {22008} [Microsoft][SQL Server Native Client 11.0]
> > > Datetime field overflow. Fractional second precision exceeds the
> > > scale specified in the parameter binding.*
> >
> > OK, so now we finally know the root cause of your problem.
> > Please consider filing a bug against
code.google.com/p/odbc [1]
> > (specify Go version, platform, SQL Server version, and the data
> > type of the column for which insertion fails; sqlncli.dll version
> > is known from the error cited above so include it in the bug
> > report, too).
[...]
> Konstantin, it is so common operation - to INSERT time.Time to
> MSSQL.datetime field. Are you sure it could be a bug there?
I don't quite follow your reasoning. You rightfully claim that if you
have a column of type datetime on the server and try to insert a value
of type time.Time into it, it should "just work" -- the driver is
supposed to provide the necessary conversion. So if you're observing
there's not the case, two possibilities are possible:
* It's a bug in the driver (or in ODBC layer or in backend ODBC driver,
provided by the SQL Server suite, which is less likely but possible).
* It's an intended behaviour. This *might* as well be true as I gather
from reading the other part of this thread: if the datetime SQL
Server's type has lower precision than time.Time, just automatically
rounding them down is not the right thing for the driver to do.
If yes, this behaviour should be documented at least.
> Ok, i will create an issue with details.
I'd say yes, that would at least increase the visibility of the problem
for the next guy to hit it.