问题描述
我试图将具有唯一标识符列的excel文件导入SQL Server,但是SSIS给我带来了很多麻烦.
I'm trying to to import an excel file with a unique identifier column into SQL server but SSIS is giving me a lot of trouble.
我可以从excel中将唯一标识符值获取到OLE DB Destination组件中,但无法将其获取到SQL Server表中.
I can get the unique identifier values from excel into the OLE DB Destination component but i can't get them into SQL Server table.
我在尝试插入唯一标识符时收到以下错误消息.
I get the error message below on trying to insert the unique identifier.
注意:在目标SQL Server表中,CreatedBy列的类型为uniqueidentifier.
NOTE: column CreatedBy is of type uniqueidentifier in the destination SQL server table.
推荐答案
我建议您尝试以下操作:
I recommend you try this:
(DT_GUID)("{"+(DT_WSTR,36)[CreatedBy]+"}")
因为您的初始字符串不包含任何方括号,所以在转换为GUID之前需要添加它们.
because your initial string doesn't contain any brackets you need to add them before converting to GUID.
玩得开心!
这篇关于在SSIS导入期间如何处理唯一标识符值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!