導入.xls到SQL時出現問題。 Excel文件具有包含超過2000個文本字符的單元格的列,因此在導入時,我將nvarchar
更改爲每列4000個。導入工作,但一列將單元格截斷爲255個字符。我檢查和列是nvarchar(4000,空),但選擇MAX(LEN(列))= 255,這很奇怪。我試圖將nvarchar
更改爲varchar(4000)
,但這不被接受。該消息是:從.xls LongText導入數據到MS SQL
[Source Information] Table: `Sheet1$` Column: q1 Column Type: VarChar SSIS Type: Unicode string [DT_WSTR] [Destination Information] Table: [dbo].[Sheet1$] Column: q1 Column Type: varchar SSIS Type: string [DT_STR]
奇怪的是,一個列有光源類型:長文本和目標類型:nvarchar的,默認情況下顯示最多的字符和進口一切行之有效的那個特定的列(超過255個字符)。對於所有其他列nvarchar
至nvarchar
可以工作,但即使更改爲4000或3000個字符,也可以在255處截斷。
我試圖重新保存Excel文件.csv格式,但隨後SQL顯示我執行(錯誤):
Task 1: Data conversion failed. The data conversion for column "Column 13" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page Task 1: The "output column "Column 13" (62)" failed because truncation occurred, and the truncation row disposition on "output column "Column 13" (62)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component. Task 1: An error occurred while processing file The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure
我不能要求客戶重新導入數據,並將其保存爲。 csv格式。
是否有可能以SQL可接受的方式格式化Excel版本,如Source Type:LongText和Destination Type:nvarchar? (我不知道爲什麼varchar
不適合我)
我已經使用Excel的簡單任務,如更改單元格到文本或複製粘貼一列到文本格式。