简体   繁体   中英

Data import from CSV to SQL Azure Database

I am trying to load CSV file to Azure Database using SQL Server Import and Export Wizard. I am getting the following error message at "Copying to "dbo".mytest_table"...

  • Copying to "dbo"."mytest_table" (Error) Messages Error 0xc020844b: Data Flow Task 1: An exception has occurred during data insertion, the message returned from the provider is: Tables without a clustered index are not supported in this version of SQL Server. Please create a clustered index and try again. (SQL Server Import and Export Wizard)

Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - mytest_table" (38) failed with error code 0xC020844B while processing input "Destination Input" (41). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure. (SQL Server Import and Export Wizard)

As you are setting up the mapping, do you create an primary key for new mytest_table? Also, look at the CSV properties, I believe there is a way to indicate the primary key column.

For anyone that comes across this in the future: if you're just importing a sheet from excel that doesn't have a primary key, do the following:

Click the 'Edit Mappings' button at the 'Select Source Tables & Views' step. Click 'Edit SQL' and add the following at the end of the SQL statement before the closing bracket to add a calculated id field: , ID INT IDENTITY(1,1) PRIMARY KEY CLUSTERED

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM