bcp 和退格 (^H) 分隔符

发布于 2024-08-16 23:11:31 字数 270 浏览 5 评论 0原文

我需要解析一个在字段之间包含退格 (^H) 字符分隔符的平面文件。我需要解析此文件并插入到 sql server 2005 表中。我尝试将 bcp 实用程序与格式文件一起使用,但无法将分隔符指定为退格键。 默认选项是制表符 (\t)。还有其他几个分隔符,但没有一个用于指定退格键。任何人有任何想法,请帮助我。

另外,我需要将数据从 sql server 表导出到固定长度平面文件。我尝试使用非 xml 格式文件,但它总是要求分隔符。如何使用 bcp 创建平面文件,而字段之间没有任何分隔符? 以上都是字符文件。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烟花易冷人易散 2024-08-23 23:11:31

这是一个丑陋的解决方法,但您总是可以找到平面文件中没有的内容,并用它替换平面文件中的所有内容,然后将其用作列终止符(使用 bcp -t that) 。

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).

GRAY°灰色天空 2024-08-23 23:11:31

抱歉,我在这方面晚了将近 11 年,希望您已经解决了您的问题,但您可以使用退格字符 0x08 的十六进制表示来解析您的输入文件并正确分隔用退格字符分隔的字段。

Sorry that I'm almost 11 years late on this, hopefully you've already solved your problem but you can use the hexadecimal representation of the backspace character 0x08 to parse your input file and properly delimit your fields which are separated with a backspace character.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文