Solved

How do you import fixed width files into SQL Server

Posted on 2008-09-30
6
334 Views
Last Modified: 2012-05-05
I have about 20 fixed length text files named as:

crt.001
crt.002
...
crt020

How can I cycle through all 20 files and import the data into SQL Server tables using T-SQL.  I may have to convert character values from the fixed text files to some date types or booleans also.l

Thanks
Nick
0
Comment
Question by:countyprob
  • 4
  • 2
6 Comments
 
LVL 29

Accepted Solution

by:
QPR earned 500 total points
ID: 22611835
http://www.sqlis.com/55.aspx

"Looping over files with the Foreach Loop"
0
 
LVL 1

Author Comment

by:countyprob
ID: 22617366
Is there anyway to do this with T-SQL?  
0
 
LVL 29

Assisted Solution

by:QPR
QPR earned 500 total points
ID: 22618124
open text files and extraxt data?
No. You could put the code into a .bat file and then use SQL to execute the .bat file
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 1

Author Comment

by:countyprob
ID: 22647156
This is becoming challenging.  Is there a tool out there that can help me import char based fix flat file data into SQL Server?
0
 
LVL 1

Author Comment

by:countyprob
ID: 22767429
I formatted the data using foxpro and then exported it a csv file.  next I imported the csv file into sql sever using the import wizard
0
 
LVL 1

Author Closing Comment

by:countyprob
ID: 31501856
I had to manipulate data using foxpro, then export to csv and finally import the csv into sql server using the wizard
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

809 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