[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

How do you import fixed width files into SQL Server

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
countyprob
Asked:
countyprob
  • 4
  • 2
2 Solutions
 
QPRCommented:
http://www.sqlis.com/55.aspx

"Looping over files with the Foreach Loop"
0
 
countyprobAuthor Commented:
Is there anyway to do this with T-SQL?  
0
 
QPRCommented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
countyprobAuthor Commented:
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
 
countyprobAuthor Commented:
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
 
countyprobAuthor Commented:
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now