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
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 importing large fixed with txt file

Author  Topic 

big_al
Starting Member

2 Posts

Posted - 2012-02-14 : 11:07:23
I'm a new SQL Server user (yesterday) and have been given the task of importing a large fixed width txt file. The file has approx 30 fields with varing data types and has over 10 million rows. I tried using the import wizard but it seems to be taking a lot longer than it should. Any suggestion would be greatly appreciated.

Beginner

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-14 : 11:12:58
Are you sure the Data is fixed wifth? Where did the data com from?

You can use bcp to INSERT The Data to a staging Table

Do you know the offsets of the columns? Do you a=have a record layout of the data?

You could use bcp and a format file

You could bcp the data into a single column staging table tyhen use SUNSTRING

Are you importing to an Existing Table?

Where i sthe Data file? Is it on the server or are you importing across a network? You should copy the data to the server you will be importing to



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

big_al
Starting Member

2 Posts

Posted - 2012-02-14 : 11:22:39
The data file comes from outside my company. they provided a record layout for the data in a PDF format. The data is on the server I am importing to. I wasn't importing it into and existing table. Thanks for your help.

Beginner
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-14 : 13:54:15
ok..can you post the layout?

Do you know what Books Online is?

http://msdn.microsoft.com/en-us/library/ms191516.aspx

Go and create a table with the exact data type and Sizes that match the pdf layout

Then you need to create a format file

The bcp in to that

You can also use the GUI to do an import


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -