简体   繁体   English

SSIS将转义的字符转换为asc(不可打印的字符)

[英]SSIS convert escaped character to asc(non printable characters)

I use SSIS to migrate some csv files (from UNIX) into SQL. 我使用SSIS将某些csv文件(从UNIX)迁移到SQL。 one csv file contains data like: 一个csv文件包含如下数据:

ID,Name,Desc ID,名称,说明

1,12345\\t,12345\\177 1,12345 \\ t,12345 \\ 177

If the schema for Name or Desc must be varchar(6), then the migration will fail due to the non printable characters are presented as \\t, \\177... 如果Name或Desc的架构必须为varchar(6),则迁移将失败,因为不可打印字符显示为\\ t,\\ 177 ...

How can I convert the escaped characters to non printable characters in SSIS? 如何在SSIS中将转义字符转换为不可打印的字符?

\\t to Char(9) \\ t到Char(9)

\\177 to Char(127) \\ 177为Char(127)

Is there a better solution? 有更好的解决方案吗?

You should be able to use regular expressions regex.unescape to do this. 您应该能够使用正则表达式regex.unescape来执行此操作。 I would suggest loading the assembly and doing it in SQL server using a temporary table, check this out http://msdn.microsoft.com/en-us/magazine/cc163473.aspx 我建议使用临时表加载程序集并在SQL Server中进行操作,请参阅http://msdn.microsoft.com/zh-cn/magazine/cc163473.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM