Re: bcp/datacopy numeric columns

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CAHt6W4c_HWJcZin0FThs7ecsS67+GcnMr7iDv-x=G_2j2ty5MA@mail.gmail.com>
2014-05-21 8:51 GMT+01:00 John Kendall <[email protected]>:
> Big thanks to Frediano for fixing bit columns in bcp.
>
> I'm running into a problem using datacopy and numerics now.  The decimals get truncated.
>
> The problem is easy to reproduce:
>
>          create table tempdb..tbla (num numeric(10,2))
>          insert tempdb..tbla values (12345.67)
>
>          $ datacopy -c dbo -S SRV/usr/pw/tempdb/tbla -D SRV/usr/pw/tempdb/tblb
>
>          select * from tempdb..tbla
>          num
>          -------------
>                12345.67
>
>
>          select * from tempdb..tblb
>          num
>          -------------
>               12345.00
>
> Note we lost 0.67.  No error messages from data copy.
> The problem occurs with both Sybase and MS SQL Server.
> I’m running this on SPARC, if endianess matters.
>
> Thanks,
> John
>
Hi,
  it happens even on Intel, it's not an architecture problem. The
problem is that dbbind does not take into consideration source
precision/scale. I'm going to improve dbbind (and perhaps add
dbbind_ps) in order to make possible to support copying numeric
entirely with precision/scale based on the source.

Frediano
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.