Sunday, March 11, 2012

Code to Import Bank Files (BAI, BAI2)

Anyone have some code to import bank files to SQL Server 2000 tables in the formats BAI or BAI2? I'm using a DTS package currently, but I'd like to have more control over this by using T-SQL or vbscript or something.

These files have complex structures/multiple record types. Not to mention my main problem of trying to use a bulk insert which doesn't seem to work because of something to do with the row delimiters. Not too sure what's up with that because I usually do this for all my flat file imports. I'm certain vbscript will work, but I'd like to know if anyone out there has already built something for these particular files?
Thanks!

I have not worked on BAI in years, but what I ended up doing was importing the file into a table with 2 fields: linetype and linevalue, then parsing the line based on the type.

The problem with the stored proc is the string processing is very limited in TSQL. It is much easier to mainupliate in VB using Split().

You could create the same affect using SSIS in a Dataflow with conditional branching on linetype. I would have to think about the type 88 lines continuation. I am not sure how you would handle that.

Also, I wrote a preproceesor which converted BAI1 to BAI2, there is not much difference. Then my code only had to deal with BAI2 files.

Good luck.

No comments:

Post a Comment