SSMS Error inserting data into table Error 4815.
Applies to: SQL Server Management Studio (SSMS).
Date created: December 25, 2022.
Problem Description.
While trying to import a CSV file to a SQL Server database using Import Flat
File Wizard of SQL Server Management Studio (SSMS), a user got the following
error message:
Error inserting data into table. (Microsoft.SqlServer.Import.Wizard)
Additional information:
Error inserting data into table. (Microsoft.SqlServer.Prose.Import.SDS)
Received an invalid column length from the bcp client for colid 5. (Microsoft
SQL Server,Error: 4815)
Cause.
Most likely the issue will be the data in one of the columns in the CSV is too
large to fit into the destination column in database.
Workaround/Solution.
Use bigger data types on the destination table. For example, in the Modify
Columns section change all varchar columns to NVARCHAR(MAX). Similarly, the
bigint data type is intended for use when integer values might exceed the range
that is supported by the int data type.