Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 "Offset" through a text file

Author  Topic 

Willem Le R
Starting Member

1 Post

Posted - 2007-11-02 : 10:02:02
I have a massive text file (110m lines) out of which I want to select blocks of data. So far I have managed to use:

SELECT TOP x fields...
FROM table
WHERE field1 NOT IN (SELECT TOP y field1 FROM table)

Looks like it’ll take about 5 days. The whole thing also becomes slower as it moves through the text file. Is there a quicker way to do an “offset�? Or another way altogether?

I’m fairly new to SQL, but any help would be greatly appreciated.

Thanx,
Willem

anonymous1
Posting Yak Master

185 Posts

Posted - 2007-11-02 : 10:24:04
if your goal is to quickly load a text file BULK INSERT or bcp are normally good options
if you already have your data imported and want to trickle data to another table over a period of time, you should look into indexing and possibly change your NOT IN to a LEFT JOIN WHERE IS NULL similar to this...
SELECT TOP x NEW DATA.*
FROM NEW_DATA
LEFT JOIN USED_DATA ON USED_DATA.ID = NEW_DATA.ID
WHERE USED_DATA.ID IS NULL
Go to Top of Page
   

- Advertisement -