jwcolby
jwcolby at colbyconsulting.com
Sat Jan 30 08:04:32 CST 2010
Amigos, I have to import a fixed width file periodically. It is fairly complex, containing perhaps 50-70 fields. I performed this import one time "manually" using the import wizard, but manually defining the field names / widths every time is not happening! So, I have a "template" table that has the field names and sizes (all nvarchar() ). I have a stored procedure I created last night which will create that table for me. I routinely use BCP to import and export "CSV" type files (delimited), and I have a C# class which allows me to quickly and easily set up a stored procedure object, set up parameters, get back error codes etc. What I need to do (it it is even possible) is to learn how to use BCP with a fixed width file. My understanding is that you use a format file in which you define the fields, data types etc. and then you pass that to BCP. Does anyone out there do this thing, any words of advice. Any alternatives which I as a SQL Server novice could possibly make happen? TIA for any assistance. -- John W. Colby www.ColbyConsulting.com