views:

271

answers:

1

I need to parse a flat file which is containing backspace (^H) character delimiter between fields. I need to parse this file and insert into sql server 2005 tables.I tried to use bcp utility along with the format file but I wasn't able to specify the delimiter as backspace. The default one is tab (\t). There are several other delimiters as well but none to specify backspace. Anyone has any ideas, please do help me.

Also I need to export data from sql server table to fixed length flat file.I tried to use non-xml format file, but always it asks for a delimiter.How can I create a flat file using bcp without any delimiter between the fields? All above are character files.

A: 

This is an ugly workaround, but you could always find something that's not in the flat file, and replace everything in the flat file with that, then use that as the column terminator (using bcp -t that).

Kev
This requires one more preprocessing step. Anything better?
Harsha
I wish. I'm waiting for an answer to a similar question that I posted that I hadn't realized might be approximately the same question as yours in essense.
Kev
Can you send me the link to that question? I was wondering if we could somehow specify ascii characters as delimiters in bcp -t option. But couldnt find any way to do that.
Harsha
Sure, sorry: http://stackoverflow.com/questions/1976086/getting-bcp-exe-to-escape-terminators . Although, you should see the note under the first table at http://msdn.microsoft.com/en-us/library/aa196735%28SQL.80%29.aspx
Kev
I am still trying to parse backspace delimited files from bcp. I am looking for answers.. any ideas most welcome..
Harsha