How can I perform an SqlBulkCopy (equivalent) using an ODBC connection in C#?

c# ibm-midrange odbc sqlbulkcopy sql-server

Question

I am working on a project where I need to extract data from a MSSQL database table, and then insert the data into a table of the same structure on an AS400.

The SqlBulkCopy would be the ideal candidate for this operation, but fails (understandably) because the AS400 uses an ODBC connection.

Any help or suggestions on this would be greatly appreciated!

Thanks

Accepted Answer

If this is a one-time only task, I would probably just extract the data from MSSQL into a CSV file. Then drop the CSV file into an IFS folder on the AS/400 and then use CPYFRMIMPF. You may have to play games with the date format to match the AS/400 formats. You can specify the date and time formats and separators on the CPYFRMIMPF command.

If this needs to be a repeatable task, then I hope someone else has a better answer.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why