Showing posts with label loading. Show all posts
Showing posts with label loading. Show all posts

Wednesday, 7 March 2012

Confusion for loading data

Hi,
I am building in a data mart using SQL server DTS. I have
confusion that
Example
Suppose we have text file for Cust table. It has 3
customers
A,
B,
C
This information comes in text file from legacy system.
We load this data in cust table in staging.
Now we get a new text file with 5 customers i.e
A,
B,
C,
D,
E.
What query shall I write to include the 2 new customers
i.e D & E in my Staging Table. How will I refer to text
file. Meaning that
select new_customers
from text file (what shall I write here to refer my text
file).
Or how is done.
If some one can solve this simple puzzle it will be great
help.
Thanks
Steve
What I usually do is import the text file "as is" in a staging table and
manipulate the data from there. Tables are a lot easier to query than text
files.
You can get your new customers with a query similar to:
SELECT customer AS new_customer
FROM staging_table s
LEFT OUTER JOIN existing_table e
ON s.customer = e.customer
WHERE e.customer IS NULL
Jacco Schalkwijk
SQL Server MVP
"Steve" <anonymous@.discussions.microsoft.com> wrote in message
news:49d101c47392$055e44a0$a301280a@.phx.gbl...
> Hi,
> I am building in a data mart using SQL server DTS. I have
> confusion that
> Example
> Suppose we have text file for Cust table. It has 3
> customers
> A,
> B,
> C
> This information comes in text file from legacy system.
> We load this data in cust table in staging.
> Now we get a new text file with 5 customers i.e
> A,
> B,
> C,
> D,
> E.
> What query shall I write to include the 2 new customers
> i.e D & E in my Staging Table. How will I refer to text
> file. Meaning that
> select new_customers
> from text file (what shall I write here to refer my text
> file).
> Or how is done.
> If some one can solve this simple puzzle it will be great
> help.
> Thanks
> Steve

Confusion for loading data

Hi,
I am building in a data mart using SQL server DTS. I have
confusion that
Example
Suppose we have text file for Cust table. It has 3
customers
A,
B,
C
This information comes in text file from legacy system.
We load this data in cust table in staging.
Now we get a new text file with 5 customers i.e
A,
B,
C,
D,
E.
What query shall I write to include the 2 new customers
i.e D & E in my Staging Table. How will I refer to text
file. Meaning that
select new_customers
from text file (what shall I write here to refer my text
file).
Or how is done.
If some one can solve this simple puzzle it will be great
help.
Thanks
SteveWhat I usually do is import the text file "as is" in a staging table and
manipulate the data from there. Tables are a lot easier to query than text
files.
You can get your new customers with a query similar to:
SELECT customer AS new_customer
FROM staging_table s
LEFT OUTER JOIN existing_table e
ON s.customer = e.customer
WHERE e.customer IS NULL
Jacco Schalkwijk
SQL Server MVP
"Steve" <anonymous@.discussions.microsoft.com> wrote in message
news:49d101c47392$055e44a0$a301280a@.phx.gbl...
> Hi,
> I am building in a data mart using SQL server DTS. I have
> confusion that
> Example
> Suppose we have text file for Cust table. It has 3
> customers
> A,
> B,
> C
> This information comes in text file from legacy system.
> We load this data in cust table in staging.
> Now we get a new text file with 5 customers i.e
> A,
> B,
> C,
> D,
> E.
> What query shall I write to include the 2 new customers
> i.e D & E in my Staging Table. How will I refer to text
> file. Meaning that
> select new_customers
> from text file (what shall I write here to refer my text
> file).
> Or how is done.
> If some one can solve this simple puzzle it will be great
> help.
> Thanks
> Steve