dbTalk Databases Forums  

dts imports , records added to table randomly. not sorted as in text file

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


Discuss dts imports , records added to table randomly. not sorted as in text file in the microsoft.public.sqlserver.dts forum.



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

Default dts imports , records added to table randomly. not sorted as in text file - 09-23-2004 , 10:50 AM






I am looking to import 7million rows worth of data from a flat text
file. all the rows seem to be copied over but they are not arranged
like they are in the flat file. each row in the text file is a record
and there are no column delimiters. hence the table should have only
on column. also note that i type in odd characters for the column
delimiter since it is require to set up the dts package.

any ideas will be greatly appreciated
let me know if you have any questions

thanks

Reply With Quote
  #2  
Old   
Peter A. Schott
 
Posts: n/a

Default Re: dts imports , records added to table randomly. not sorted as in text file - 09-23-2004 , 11:41 AM






I think this is the normal behaviour for SQL Server. Data is not guaranteed
to be returned in any specific order unless you use an ORDER BY clause. You
may consider something like inserting into a table with an IDENTITY value for
the PK and order by that Identity value.

-Pete

robert_emoghene (AT) hotmail (DOT) com (rob) wrote:

Quote:
I am looking to import 7million rows worth of data from a flat text
file. all the rows seem to be copied over but they are not arranged
like they are in the flat file. each row in the text file is a record
and there are no column delimiters. hence the table should have only
on column. also note that i type in odd characters for the column
delimiter since it is require to set up the dts package.

any ideas will be greatly appreciated
let me know if you have any questions

thanks


Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: dts imports , records added to table randomly. not sorted as in text file - 09-23-2004 , 12:42 PM



Peter is correct.

Without an ORDER BY clause the order is _NOT_ guaranteed. Seeing as you
cannot use any funky stuff on a flat file you will need to import into a
staging table then from there into your proper table


Allan


"Peter A. Schott" <pschott (AT) no (DOT) spamm.hear.drivefinancial.com> wrote in
message news:b4v5l093me7pm8s0joeu88van6jdf8oq0s (AT) 4ax (DOT) com...
Quote:
I think this is the normal behaviour for SQL Server. Data is not
guaranteed
to be returned in any specific order unless you use an ORDER BY clause.
You
may consider something like inserting into a table with an IDENTITY value
for
the PK and order by that Identity value.

-Pete

robert_emoghene (AT) hotmail (DOT) com (rob) wrote:

I am looking to import 7million rows worth of data from a flat text
file. all the rows seem to be copied over but they are not arranged
like they are in the flat file. each row in the text file is a record
and there are no column delimiters. hence the table should have only
on column. also note that i type in odd characters for the column
delimiter since it is require to set up the dts package.

any ideas will be greatly appreciated
let me know if you have any questions

thanks




Reply With Quote
  #4  
Old   
rob
 
Posts: n/a

Default Re: dts imports , records added to table randomly. not sorted as in text file - 09-24-2004 , 09:49 AM



thanks Guys, the light finally came on. i was trying to import a flat
file where 4,5 or 6 rows make a record. sqlserver will not guarantee
the exact sequence in the flat file, so I wrote a vb app to recreate
the flat file with an extra column (rowcount). now i have a row to
order my results by giving me the exact arrangement i had in flat
file. yep i did need an intermediary table to create my table ordered
by row number.
thanks again
let me know if you have any questions

Quote:
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Peter is correct.

Without an ORDER BY clause the order is _NOT_ guaranteed. Seeing as you
cannot use any funky stuff on a flat file you will need to import into a
staging table then from there into your proper table


Allan


"Peter A. Schott" <pschott (AT) no (DOT) spamm.hear.drivefinancial.com> wrote in
message news:b4v5l093me7pm8s0joeu88van6jdf8oq0s (AT) 4ax (DOT) com...
I think this is the normal behaviour for SQL Server. Data is not
guaranteed
to be returned in any specific order unless you use an ORDER BY clause.
You
may consider something like inserting into a table with an IDENTITY value
for
the PK and order by that Identity value.

-Pete

robert_emoghene (AT) hotmail (DOT) com (rob) wrote:

I am looking to import 7million rows worth of data from a flat text
file. all the rows seem to be copied over but they are not arranged
like they are in the flat file. each row in the text file is a record
and there are no column delimiters. hence the table should have only
on column. also note that i type in odd characters for the column
delimiter since it is require to set up the dts package.

any ideas will be greatly appreciated
let me know if you have any questions

thanks


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.