[
https://issues.apache.org/jira/browse/SQOOP-1403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14110754#comment-14110754
]
Keegan Witt commented on SQOOP-1403:
------------------------------------
I took some time to verify my theory, and I believe this is what's happening.
SQL Server's generated _write()_ looks like this for my sample table
{code:java}
public int write(PreparedStatement __dbStmt, int __off) throws SQLException {
JdbcWritableBridge.writeInteger(v, 1 + __off, 4, __dbStmt);
JdbcWritableBridge.writeInteger(k, 2 + __off, 4, __dbStmt);
return 2;
}
{code}
But Oracle's generated _write()_ looks like this
{code:java}
public int write(PreparedStatement __dbStmt, int __off) throws SQLException {
JdbcWritableBridge.writeBigDecimal(K, 1 + __off, 2, __dbStmt);
JdbcWritableBridge.writeBigDecimal(V, 2 + __off, 2, __dbStmt);
JdbcWritableBridge.writeBigDecimal(K, 3 + __off, 2, __dbStmt);
JdbcWritableBridge.writeBigDecimal(V, 4 + __off, 2, __dbStmt);
return 4;
}
{code}
I'm fairly certain it's this difference that makes Oracle work with the _MERGE_
statement, as you'd need to do the column substitution twice (once for the
insert portion, once for the update portion). This leaves us with two options.
We can use the _SET_ syntax we've described and seen work. Or we can change
the code generator for SQL Server so that it can work the same way Oracle does.
I like that this avoids the _SET_ structure, but it will be a larger change.
Another downside to changing the code generator is that I'm not sure we could
make it work with the conditional upsert approach (though this mostly only
matters for older SQL Server versions). What do you recommend?
> Upsert export for SQL Server
> ----------------------------
>
> Key: SQOOP-1403
> URL: https://issues.apache.org/jira/browse/SQOOP-1403
> Project: Sqoop
> Issue Type: New Feature
> Components: connectors/sqlserver
> Reporter: Keegan Witt
> Assignee: Keegan Witt
> Attachments: SQOOP-1403_non_func.patch
>
>
> Same as has been done in SQOOP-327 and SQOOP-621 (and requested in
> SQOOP-1270), but for SQL Server.
--
This message was sent by Atlassian JIRA
(v6.2#6252)