On 27 January 2014 17:18, Vadim Zeitlin <[email protected]> wrote:

> On Mon, 27 Jan 2014 17:13:29 +0000 Andrew Grafham <
> [email protected]> wrote:
>
> AG> Is there a way of accurately bulk inserting into a decimal field in SQL
> AG> server?
>
>  Sorry for the bad news but no, there is no support for inserting string
> values in SQL_DECIMAL columns in the current ODBC backend code.
>
>  Worse, I'm not actually sure how would one modify the code to do it as
> currently it assumes a one-to-one mapping between SQL and C++ types, but
> this is just not true for SQL_DECIMAL which should be convertible to both
> double (if the potential accuracy loss doesn't matter) and string (if we
> really need to store the exact representation).
>
>  Regards,
> VZ
>

Thanks for the quick response. I've just realised I can work around this by
doing a "convert" in the SQL, e.g. :-

        sql << "insert into nets(id, net) values(:id, convert (decimal
(32,6), :net ))",

            use(ids), use(nets);

Cheers

Andy
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to