Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column

后端 未结 6 940
心在旅途
心在旅途 2020-12-02 07:35

I\'m trying to insert a large CSV file (several gigs) into SQL Server, but once I go through the Import Wizard and finally try to import the file I

6条回答
  •  一生所求
    2020-12-02 08:01

    In SQL Server Import and Export Wizard you can adjust the source data types in the Advanced tab (these become the data types of the output if creating a new table, but otherwise are just used for handling the source data).

    The data types are annoyingly different than those in MS SQL, instead of VARCHAR(255) it's DT_STR and the output column width can be set to 255. For VARCHAR(MAX) it's DT_TEXT.

    So, on the Data Source selection, in the Advanced tab, change the data type of any offending columns from DT_STR to DT_TEXT (You can select multiple columns and change them all at once).

提交回复
热议问题