In MySQL I am able to create a table with fixed column widths and then can use the load data infile command to import a fixed width file.
For example:
Fixed width text file = JOHN 1234
Imports into table:
Username - CHAR(8)
Password - ChAR(4)
The beauty of this approach is that the file is ‘chopped’ up based on the column sizes defined in the MySQL table.
Now there is a new project requiring SQL Server 2005.
Does SQL Server have a function similar to load data infile? Or is this a better approach then the one I’m taking.
You do have similar functionality with SQL Server. I would encourage you to learn about format files. This page, from Microsoft, does a fairly good job of explaining it.
http://msdn.microsoft.com/en-us/library/ms178129.aspx
I would also encourage you to read this blog:
6 ways to import data into SQL Server