Requirement is to copy a table say account in server A to table account_two in server B. There are many tables like this each having thousands of rows.
I want to try BCP for it. The problem is account_two might have fewer cols than account. I understand in such scenarios I can either use a format file or a temp table.
The issue is I do not own Server A tables. And in case someone changes the order and the no of col , bcp will fail.
In Sybase queryout is not working. The only option left is doing a select A , B from account in server A and then writing this output to a file and using this file as the date file in BCP IN .
However, since it is huge data I am not able to find a convenient way of doing this.
while ( $my row = $isth->fetchrow_arrayref) {
print FILE JOIN ("\t",@$row),"\n";
}
But using this performance will be hit.
I cannot use dump_results() or dumper. It will be additional task to bring thousands of lines of data into bcp data file format.
if someone can help me in deciding the best approach.
PS: I am new to PERL. Sorry, if there is an obvious answer to this.