Sorry, please disregard this question. The money type is correctly mapped
to BigDecimal by sqoop-codegen.

My problem was that I was converting my Double values like this,
private static BigDecimal toBigDecimal(Double value) {
return value == null ? null : new BigDecimal(value);
}

`new BigDecimal(double)` automatically uses the maximum scale, which
wouldn't fit in my SQL decimals. Changing to this worked,
private static BigDecimal toBigDecimal(Double value) {
return value == null ? null : new BigDecimal(value.toString());
}


On Wed, Feb 3, 2016 at 12:50 PM, Ali Thawban <orobor...@gmail.com> wrote:

> Hello,
>
> I'm trying to export SequenceFiles created by my MapReduce job to a SQL
> Server table for analysis. To do this, I first ran sqoop-codegen to create
> a SqoopRecord class Sqoop can use.
>
> However, sqoop-codegen used Strings for the SQL Server money fields. This
> results in "Error converting data type nvarchar to decimal" errors when I
> try to export.
>
> The Microsoft SQL Server JDBC driver maps money columns to BigDecimal:
> https://msdn.microsoft.com/en-us/library/ms378878(v=sql.110).aspx
>
> I can't find any mention of money in the user guide, whereas there is
> mention of specific Oracle types.
> I'm also having immense difficulty finding any documentation at all on
> exporting SequenceFiles.
>
> Is money supported? I know I can use decimal instead, but just want to be
> sure before modifying my table.
>

Reply via email to