![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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. |
#4
| |||
| |||
|
|
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. |
#5
| |||
| |||
|
|
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 |
#6
| |||
| |||
|
|
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 news A6E492C-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. |
#7
| |||
| |||
|
|
Actually, since there is no data in the file that clearly distinguishes which header information goes with which detail information other that the |
|
"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 news A6E492C-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. |
#8
| |||
| |||
|
|
'Good thing Joe Celko doesn't read this group. |

![]() |
| Thread Tools | |
| Display Modes | |
| |