Azure Data Studio Data Import Error

Sherlan Emmanuel Burgonia 86 Reputation points
2022-09-21T06:10:38.343+00:00

Hi, I'm trying to import a csv table through the Import flat file wizard on the Azure Data Studio and updating its datatype to varchar. Moreover, it's a TEXT format already in CSV.

243236-image.png

However, when I try to import data, I'm getting this error.

✗ Microsoft.SqlServer.Prose.Import.BcpProcessException: Error creating table. ---> Microsoft.Data.SqlClient.SqlException: Enforced unique constraints are not supported. To create an unenforced unique constraint you must include the NOT ENFORCED syntax as part of your statement.

Can you help me on how to proceed with this?

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
986 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Ifenna Ngini 0 Reputation points
    2023-02-20T18:46:22.4233333+00:00

    The error is " Microsoft.SqlServer.Prose.Import.BcpProcessException: Error inserting data into table.
    ---> System.InvalidOperationException: The given value '9.59' of type String from the data source cannot be converted to type time for Column 52 [diabetes_prevalence].
    ---> System.FormatException: Failed to convert parameter value from a String to a TimeSpan.
    ---> System.FormatException: String '9.59' was not recognized as a valid TimeSpan.
    at System.Globalization.TimeSpanParse.TimeSpanResult.SetBadTimeSpanFailure()
    at System.Globalization.TimeSpanParse.ProcessTerminal_HM(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result)
    at System.Globalization.TimeSpanParse.ProcessTerminalState(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result)
    at System.Globalization.TimeSpanParse.TryParseTimeSpan(ReadOnlySpan1 input, TimeSpanStandardStyles style, IFormatProvider formatProvider, TimeSpanResult& result) at Microsoft.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType, Boolean& coercedToDataFeed, Boolean& typeChanged, Boolean allowStreaming) --- End of inner exception stack trace --- at Microsoft.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType, Boolean& coercedToDataFeed, Boolean& typeChanged, Boolean allowStreaming) at Microsoft.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaData metadata, Boolean isNull, Boolean& isSqlType, Boolean& coercedToDataFeed) --- End of inner exception stack trace --- at Microsoft.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaData metadata, Boolean isNull, Boolean& isSqlType, Boolean& coercedToDataFeed) at Microsoft.Data.SqlClient.SqlBulkCopy.ReadWriteColumnValueAsync(Int32 col) at Microsoft.Data.SqlClient.SqlBulkCopy.CopyColumnsAsync(Int32 col, TaskCompletionSource1 source)
    at Microsoft.Data.SqlClient.SqlBulkCopy.CopyRowsAsync(Int32 rowsSoFar, Int32 totalRows, CancellationToken cts, TaskCompletionSource1 source) at Microsoft.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinued(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource1 source)
    at Microsoft.Data.SqlClient.SqlBulkCopy.CopyBatchesAsync(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource1 source) at Microsoft.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestContinuedAsync(BulkCopySimpleResultSet internalResults, CancellationToken cts, TaskCompletionSource1 source)
    at Microsoft.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestAsync(CancellationToken cts, TaskCompletionSource1 source) at Microsoft.Data.SqlClient.SqlBulkCopy.WriteToServerInternalAsync(CancellationToken ctoken) at Microsoft.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServerAsync(Int32 columnCount, CancellationToken ctoken) at Microsoft.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at Microsoft.SqlServer.Prose.Import.BcpTextSynthesis.InsertIntoDB(String inputFilePath, String tableName, String schemaName, IReadOnlyList1 columnInfo, SqlConnection connection, Int32 batchSize, SqlTransaction transaction, IList1 allFinalTransformations, IList1 allFinalTransformationColumns, IList1 allFinalColNames) --- End of inner exception stack trace --- at Microsoft.SqlServer.Prose.Import.BcpTextSynthesis.InsertIntoDB(String inputFilePath, String tableName, String schemaName, IReadOnlyList1 columnInfo, SqlConnection connection, Int32 batchSize, SqlTransaction transaction, IList1 allFinalTransformations, IList1 allFinalTransformationColumns, IList`1 allFinalColNames)
    at Microsoft.SqlServer.Prose.Import.BcpProcess.CreateTableAndInsertDataIntoDb(String connectionString, Int32 batchSize, String azureAccessToken)"

    I gotthis error from the import wizard, when I tried importing a csv file

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.