使用批量插入将 csv 文件导入到 mssql 数据库会更改特殊字符“æøå”一些未知的编码
我正在尝试使用 BULK INSERT 方法将 csv 文件导入到 mssql 数据库中。问题是它包含特殊字符(挪威字母 æ、ø 和 å),并且在运行插入后,它们会被我不知道编码的字符替换。
更具体地说,将ø替换为°,å替换为Õ,æ替换为μ。
我还尝试在插入之前将它们转换为 UTF-8,但我知道 BULK INSERT 方法不支持此操作。 æøå 各自的 UTF-8 编码最终会得到类似 +© 的结果。
我还尝试使用向导导入功能,但由于我在其中一列上具有标识,因此导入只会为每个记录插入一个 0,从而导致导入对于复制毫无用处。
任何人都知道我在运行批量插入时如何设置编码,因为它与标识列完美配合。我正在使用 MS SQL Server Management Studio 2008
I am trying to import a csv file to a mssql database with the BULK INSERT method. Problem is that it contains special character (norwegian letters æ, ø, and å) and after the insert is ran they get replaced by characters I don't know the encoding of.
To be more specific, ø is replaced with °, å is replaced with Õ and æ is replaced with µ.
I also tried to convert them to UTF-8 before inserting, but I understood that the BULK INSERT method doesn't support this. The respective UTF-8 encodings for æøå then ended up with something like +©.
I have also tried to use the wizard import function, but since I have identity on one of the columns, the import will just insert a 0 for every record rendering the import useless for copying.
Anyone know how I could set the encoding when running the bulk insert as it works perfectly with the identity column. I am using MS SQL Server Managent Studio 2008
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为有两种方法:
I think there are two ways: