Truncation errors importing to SQL Server 2005 from Excel

后端 未结 7 1307
一整个雨季
一整个雨季 2020-12-31 05:38

Long story short, I\'m taking a bunch of excel documents one by one, and importing them using the Import/Export wizard into a database in SQL Server 2005.

Here\'s on

7条回答
  •  忘掉有多难
    2020-12-31 06:31

    When I get truncation errors, I insert 8 dummy rows. Each cell has junk text with length > 256. This forces the detected data type to be varchar(max) instead of varchar(256). If a row is a number column, I have to fill it in with a number (for example, 0) and if it is a date, I have to fill in a dummy date or else the columns will import with null data.

    I then delete these junk rows after the import.

提交回复
热议问题