dbTalk Databases Forums  

Does DTS import rows from files in their physical sequence?

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Does DTS import rows from files in their physical sequence? in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Eric Jerome
 
Posts: n/a

Default Does DTS import rows from files in their physical sequence? - 06-19-2004 , 04:13 PM






Does DTS (or the OLEDB driver it uses) import rows from txt or xls files in their physical sequence in the file? Some experimenting doesn't turn up any instances where it didn't, but I need to be sure that the destination work table will always receive the data in the order it exists in the file (so I can link header and detail rows using an identity column in the destination table). Thanks in advance.

Reply With Quote
  #2  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: Does DTS import rows from files in their physical sequence? - 06-19-2004 , 10:25 PM






No there is no guarantee of the order in which rows get inserted. If you
need to link header and details you should not use an Identity.

--
Andrew J. Kelly SQL MVP


"Eric Jerome" <Eric Jerome (AT) discussions (DOT) microsoft.com> wrote

Quote:
Does DTS (or the OLEDB driver it uses) import rows from txt or xls files
in their physical sequence in the file? Some experimenting doesn't turn up
any instances where it didn't, but I need to be sure that the destination
work table will always receive the data in the order it exists in the file
(so I can link header and detail rows using an identity column in the
destination table). Thanks in advance.




Reply With Quote
  #3  
Old   
Eric Jerome
 
Posts: n/a

Default Re: Does DTS import rows from files in their physical sequence? - 06-20-2004 , 05:27 PM



Thanks. I didn't want to write automatic line numbering code for the files if it wasn't necessary - looks like it is.

"Andrew J. Kelly" wrote:

Quote:
No there is no guarantee of the order in which rows get inserted. If you
need to link header and details you should not use an Identity.

--
Andrew J. Kelly SQL MVP


"Eric Jerome" <Eric Jerome (AT) discussions (DOT) microsoft.com> wrote in message
news:604BDAC9-23C7-47D3-9617-71EB46888B75 (AT) microsoft (DOT) com...
Does DTS (or the OLEDB driver it uses) import rows from txt or xls files
in their physical sequence in the file? Some experimenting doesn't turn up
any instances where it didn't, but I need to be sure that the destination
work table will always receive the data in the order it exists in the file
(so I can link header and detail rows using an identity column in the
destination table). Thanks in advance.




Reply With Quote
  #4  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: Does DTS import rows from files in their physical sequence? - 06-20-2004 , 07:50 PM



I usually import files like this into a staging table and then from there do
the inserts into the production ones. That way you can control such things
as inserts into a table with Identity columns. You can insert the header,
get the Identity with Scope_Identity() and use it to insert the details.

--
Andrew J. Kelly SQL MVP


"Eric Jerome" <EricJerome (AT) discussions (DOT) microsoft.com> wrote

Quote:
Thanks. I didn't want to write automatic line numbering code for the
files if it wasn't necessary - looks like it is.

"Andrew J. Kelly" wrote:

No there is no guarantee of the order in which rows get inserted. If
you
need to link header and details you should not use an Identity.

--
Andrew J. Kelly SQL MVP


"Eric Jerome" <Eric Jerome (AT) discussions (DOT) microsoft.com> wrote in message
news:604BDAC9-23C7-47D3-9617-71EB46888B75 (AT) microsoft (DOT) com...
Does DTS (or the OLEDB driver it uses) import rows from txt or xls
files
in their physical sequence in the file? Some experimenting doesn't turn
up
any instances where it didn't, but I need to be sure that the
destination
work table will always receive the data in the order it exists in the
file
(so I can link header and detail rows using an identity column in the
destination table). Thanks in advance.






Reply With Quote
  #5  
Old   
Jim Young
 
Posts: n/a

Default Re: Does DTS import rows from files in their physical sequence? - 06-20-2004 , 09:00 PM



'Good thing Joe Celko doesn't read this group.


"Eric Jerome" <Eric Jerome (AT) discussions (DOT) microsoft.com> wrote

Quote:
Does DTS (or the OLEDB driver it uses) import rows from txt or xls files
in their physical sequence in the file? Some experimenting doesn't turn up
any instances where it didn't, but I need to be sure that the destination
work table will always receive the data in the order it exists in the file
(so I can link header and detail rows using an identity column in the
destination table). Thanks in advance.




Reply With Quote
  #6  
Old   
Eric Jerome
 
Posts: n/a

Default Re: Does DTS import rows from files in their physical sequence? - 06-21-2004 , 10:25 AM



Actually, since there is no data in the file that clearly distinguishes which header information goes with which detail information other that the sequence in which they appear in the file, I have to use VB / VBA code to add line numbers to the files before they are imported . Otherwise DTS may shuffle the rows and I will have no way of telling which detail rows go with which header rows. For example, a file may have customer information on the first row followed by several rows of invoice information for that customer's invoices (but no customer ID or other field to link the two types of rows with). Then there would be another customer row followed by more invoice rows that go with that second customer, etc...

"Andrew J. Kelly" wrote:

Quote:
I usually import files like this into a staging table and then from there do
the inserts into the production ones. That way you can control such things
as inserts into a table with Identity columns. You can insert the header,
get the Identity with Scope_Identity() and use it to insert the details.

--
Andrew J. Kelly SQL MVP


"Eric Jerome" <EricJerome (AT) discussions (DOT) microsoft.com> wrote in message
newsA6E492C-D50B-4AD4-944F-17F10ED4B963 (AT) microsoft (DOT) com...
Thanks. I didn't want to write automatic line numbering code for the
files if it wasn't necessary - looks like it is.

"Andrew J. Kelly" wrote:

No there is no guarantee of the order in which rows get inserted. If
you
need to link header and details you should not use an Identity.

--
Andrew J. Kelly SQL MVP


"Eric Jerome" <Eric Jerome (AT) discussions (DOT) microsoft.com> wrote in message
news:604BDAC9-23C7-47D3-9617-71EB46888B75 (AT) microsoft (DOT) com...
Does DTS (or the OLEDB driver it uses) import rows from txt or xls
files
in their physical sequence in the file? Some experimenting doesn't turn
up
any instances where it didn't, but I need to be sure that the
destination
work table will always receive the data in the order it exists in the
file
(so I can link header and detail rows using an identity column in the
destination table). Thanks in advance.







Reply With Quote
  #7  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: Does DTS import rows from files in their physical sequence? - 06-21-2004 , 10:44 AM



Can't you request they provide the key to be included int he file when it is
generated? How does the other system know what goes with what? That's a
pretty absurd way to match records and prone for failure.

--
Andrew J. Kelly SQL MVP


"Eric Jerome" <EricJerome (AT) discussions (DOT) microsoft.com> wrote

Quote:
Actually, since there is no data in the file that clearly distinguishes
which header information goes with which detail information other that the
sequence in which they appear in the file, I have to use VB / VBA code to
add line numbers to the files before they are imported . Otherwise DTS may
shuffle the rows and I will have no way of telling which detail rows go with
which header rows. For example, a file may have customer information on the
first row followed by several rows of invoice information for that
customer's invoices (but no customer ID or other field to link the two types
of rows with). Then there would be another customer row followed by more
invoice rows that go with that second customer, etc...
Quote:
"Andrew J. Kelly" wrote:

I usually import files like this into a staging table and then from
there do
the inserts into the production ones. That way you can control such
things
as inserts into a table with Identity columns. You can insert the
header,
get the Identity with Scope_Identity() and use it to insert the details.

--
Andrew J. Kelly SQL MVP


"Eric Jerome" <EricJerome (AT) discussions (DOT) microsoft.com> wrote in message
newsA6E492C-D50B-4AD4-944F-17F10ED4B963 (AT) microsoft (DOT) com...
Thanks. I didn't want to write automatic line numbering code for the
files if it wasn't necessary - looks like it is.

"Andrew J. Kelly" wrote:

No there is no guarantee of the order in which rows get inserted.
If
you
need to link header and details you should not use an Identity.

--
Andrew J. Kelly SQL MVP


"Eric Jerome" <Eric Jerome (AT) discussions (DOT) microsoft.com> wrote in
message
news:604BDAC9-23C7-47D3-9617-71EB46888B75 (AT) microsoft (DOT) com...
Does DTS (or the OLEDB driver it uses) import rows from txt or xls
files
in their physical sequence in the file? Some experimenting doesn't
turn
up
any instances where it didn't, but I need to be sure that the
destination
work table will always receive the data in the order it exists in
the
file
(so I can link header and detail rows using an identity column in
the
destination table). Thanks in advance.









Reply With Quote
  #8  
Old   
--CELKO--
 
Posts: n/a

Default Re: Does DTS import rows from files in their physical sequence? - 06-24-2004 , 09:53 AM



Quote:
'Good thing Joe Celko doesn't read this group.
But I do scan for my name every now and then


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.