Import out of order from Files

Import out of order from Files

Post by Darr » Thu, 18 Apr 2002 11:57:44



Hi any help would be really appreciated.

I am importing data from a text file to a table in sql server and want
to keep the records in the same order in the table as they are in the
text file. It seems to work 95% of the time. I need it to be in the
same order because the text file contains 4 sets of data. I only need
3.

Thanks
Darren

 
 
 

Import out of order from Files

Post by Andrew J. Kell » Thu, 18 Apr 2002 21:00:34


Darren,

SQL Server has no real notion of a physical order of rows in a table with
the exception of a clustered index.  You can't guarantee what physical order
they get inserted but once they are in the table you can get them back out
in a particular order if you use an ORDER BY clause.

--
Andrew J. Kelly   SQL MVP
Targitinteractive, Inc.


Quote:> Hi any help would be really appreciated.

> I am importing data from a text file to a table in sql server and want
> to keep the records in the same order in the table as they are in the
> text file. It seems to work 95% of the time. I need it to be in the
> same order because the text file contains 4 sets of data. I only need
> 3.

> Thanks
> Darren


 
 
 

Import out of order from Files

Post by Darr » Fri, 19 Apr 2002 08:17:33


Thanks for your input. Unfortunately i don't have a column to order
by. I am going to use an active X script to split the file up into
it's constituent parts before inserting into the table

Thanks
Darren

> Darren,

> SQL Server has no real notion of a physical order of rows in a table with
> the exception of a clustered index.  You can't guarantee what physical order
> they get inserted but once they are in the table you can get them back out
> in a particular order if you use an ORDER BY clause.

> --
> Andrew J. Kelly   SQL MVP
> Targitinteractive, Inc.



> > Hi any help would be really appreciated.

> > I am importing data from a text file to a table in sql server and want
> > to keep the records in the same order in the table as they are in the
> > text file. It seems to work 95% of the time. I need it to be in the
> > same order because the text file contains 4 sets of data. I only need
> > 3.

> > Thanks
> > Darren

 
 
 

1. Imported text file is out of order

I am using DTS to import a text file into an Access
database. The database is used to parse the file. The
problem is that the lines in the file, which are saved as
rows in the database, must be in order. When I import
larger files I am finding that a few of the lines are out
of order. Is there any way to insure that when the text is
imported the rows all stay in the same order? Any help or
suggestions would be greatly appreciated.

Thanks
KS

2. hide databases

3. sorting order when importing from xls file

4. Database cleaning

5. BULK COPY changes row order importing Text file

6. trace files are huge, bigest 2G

7. Importing a list of .txt files in numerical order

8. DTS Questions....

9. Paradox lock files and kick outs

10. Importing text files into SQL Server 2000 Database using DTS Import/Export Wizard

11. Dts Import Question:Importing Csv file in an existing SQL2000 table with row-level conditions

12. DTS Import Error When Importing Text File

13. Specify import order for DTS