Wednesday, March 7, 2012

need ideas on how to approach this issue

All,
Need ideas on how to approach this I'm writing a c# program:
Have to compare account numbers in one table to account numbers in
another table and if they exist in the second table
The problem is the tables are in two separate databases (two different
physical places). One table in the ERP system and the other is in the
financial system.
table1 ERP system
table2 Financial system
1. Should I dump table 1 into dataset table, do the same with table
two. This way they are both in the same dataset then figure out how to
compare 1 to 2?
2. Do I dump table 1 into an array and iterate through the array
making sql calls (using a data reader) to see if the account numbers
exist in second table?
3. Put both tables in the arrays and hack away?
What do you consider a good approach or best practice?
Thanks in advance
RC
The fast way is to somehow get all the numbers in one location (on one
server). You can then execute a SQL statement that performs a JOIN or uses
WHERE EXISTS to determine which numbers match.
You could use DTS to get the data out. Or you could read them to a file
(from the one server) and then build insert statements to load the data into
a temp table (denoted by a # sign) on the other server -- against which you
would run the appropriate query.
Keith
"RC" <rick_castrejon@.email.com> wrote in message
news:1120869189.371998.244770@.g14g2000cwa.googlegr oups.com...
> ----
> All,
> Need ideas on how to approach this I'm writing a c# program:
> Have to compare account numbers in one table to account numbers in
> another table and if they exist in the second table
> The problem is the tables are in two separate databases (two different
> physical places). One table in the ERP system and the other is in the
> financial system.
> table1 ERP system
> table2 Financial system
> 1. Should I dump table 1 into dataset table, do the same with table
> two. This way they are both in the same dataset then figure out how to
> compare 1 to 2?
> 2. Do I dump table 1 into an array and iterate through the array
> making sql calls (using a data reader) to see if the account numbers
> exist in second table?
> 3. Put both tables in the arrays and hack away?
> What do you consider a good approach or best practice?
> Thanks in advance
> RC
>

No comments:

Post a Comment