Excel 导入SQL错误】实例:[styling]字段

Error 0xc020902a: Data Flow Task 1: The "output column "styling" (96)" failed because truncation occurred, and the truncation row disposition on "output column "styling" (96)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
(SQL Server Import and Export Wizard)

 

解决方案

 为什么[styling]字段会被识别成两种不同的类型?

 从网上查知SQL2008是通过扫描EXCEL的前8行的各个数据的内容来估计该表各个列的数据的长度的,

在前8行中“投诉描述”中有内容超过255字符的条目的时候自然会被判定为LongText类型从而成功导入,

反之在前8行中“投诉描述”的内容中没有超过255字符而后面又有超过255字符的条目的话就会报truncation error这个错误导入失败。

因此解决这个问题的方法 就是在第一行中添加 填充字符串,超过255,导入后在删除.

【部署常用SQL】

UPDATE    [Table] SET   [Field] = REPLACE([Field], oldString, NewString)

posted on 2012-11-24 20:35  极简  阅读(1316)  评论(0编辑  收藏  举报