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
 Import/Export (DTS) and Replication (2000)
 exporting a mixed format text file (part fixed length and part delimited)

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-04 : 08:15:51
Perry writes "I am trying to figure out how to export a text file that is partly fixed length and partly delimited by "|". I don't have trouble bcp'ing out a file that has a consistent format (all fixed or all delimited), but this is beyond me. I am using MS SQL 7 on a Windows 2000 server. I am not sure what other information might be needed to answer a question like this, so please e-mail them to me. If this has been answered somewhere already, I apalogize, but I have searched Books On-line and MS and a few SQL sites, but haven't been able to find anything.


thanks"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-06-04 : 08:27:25
I have to ask why you want to mix formats like this. It really doesn't make any sense, and as you are finding out, it's not easy to do.

Go to Top of Page

calder
Starting Member

2 Posts

Posted - 2002-06-04 : 10:08:55
believe me I would avoid this like the plague if I could. this is needed for a new client that we will be doing CC authorizations for. the program that was provided for us, imports and exports a mixed format file.

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-06-04 : 10:35:07
Can you post:

1. The table structures you are using;
2. Some sample data;
3. And the file format you must deliver

Go to Top of Page

dataphile
Yak Posting Veteran

71 Posts

Posted - 2002-06-05 : 03:02:54
You need to treat the fixed part as one field and chop the delimited part up into fields as you export this file to a fixed field text file, then import the fixed field text file into whatever you want.
In other words, blindly treat the source file as a |-delimited file.
Then export to fixed field.
Then to the destination.

Delimited --> Fixed Field--> Destination
eg.

field1 field2 field3|field4|field5
xxxxxx xxxxxx xx|x|xxxx

into

field1 field2 field3 field4 field5
xxxxxx xxxxxx xx x xxxx


then into the real destination.

--Always a pleasure.

Go to Top of Page

calder
Starting Member

2 Posts

Posted - 2002-06-06 : 12:57:32
someone local told me the same thing and it works beautifully. all of the fixed fields are right at the beginning and it just never dawned on me to do something as simple as treat it as one field.


thanks again.

Go to Top of Page
   

- Advertisement -