Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Import Fixed width text file into SQL2000

Author  Topic 

Motanihatim
Starting Member

1 Post

Posted - 2009-05-28 : 21:15:36
Hi Guys,
I am not an expert in SQL and strugling to import fixed width file into SQL. I am getting daily a file from bank which give list of dishonour payment from our customer. There is always 1st header line and last footer line and in middle details of customers. I need to import midddle lines (only customer ID, Amound and Date) from each line which is always on 26 to 30 , 74 to 80 and 147 to 152 in each line. I need these details in SQL so I can run other script and cancel payment so it will become outstanding from customers.
I am not sure how to write a script to get this specific field in a table (which I have created for these three details).
Can someone help me for writing script?
Thanks in advance

Hatim

nr
SQLTeam MVY

12543 Posts

Posted - 2009-05-29 : 03:27:19
You could use dts.

If you don't know or want to use that then bcp (probably easier).
I would bcp into a single column table then use substring to move into the destination omitting the header and footer.



==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -