Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Fixed Width File Importing in SQL

Posted on 2008-06-20
1
Medium Priority
?
220 Views
Last Modified: 2013-11-30
I have 8 large text files(approx 4GB each) , all of them are formatted in fixed width - each with the same layout. There are also roughly 400 columns on each file.

I have a layout guide telling me the field names, field start column and and field width.

My question is, is there an easy way to import the files into SQL server 2005, perhaps utilising the layout guide i have, rather than manually specifying column widths for the files in something like the Import wizard in SQL?
0
Comment
Question by:adamcutting
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 17

Accepted Solution

by:
dbaSQL earned 375 total points
ID: 21830041
oh yes.  you should use bulk insert, it is probably one of the fastest means of loading the data to sql, and you can specify the file formats (layout guide) using a format file.  
see here, very good information regarding bulk insert:
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/be3984e1-5ab3-4226-a539-a9f58e1e01e2.htm

also, details regarding the format file you'll need to use to specify datatypes, lengths, order, etc.:
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/b7b97d68-4336-4091-aee4-1941fab568e3.htm

0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question