views:

134

answers:

1

Hi all,

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

A: 

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.

Tracy Probst
Thanks for this, unfortunantely it is a daily update - in the end I just created a datatable for each table in the database, then looped through the rows building a insert query in batches of 50 and then fired that over to the AS/400 to do the insert.Not exactly the way i had in mind, but it works, and batching into groups of 50 stops Movex from slowing down too much and doesn't leave too many connections open!
Matt