1 year ago
#355633

oastephs
Error Importing 2 rows from .csv to Microsoft sql server management
I'm trying to import a flat file, but there is an error when getting to one of the rows:
Error inserting data into table occured while inserting rows 1483 - 1484. Microsoft.SqlServer.Import.Wizard)
------------------------------ ADDITIONAL INFORMATION:
Error inserting data into table occured while inserting rows 1483 - 1484. (Microsoft.SqlServer.Prose.Import.SDS)
The given value of type String from the data source cannot be converted to type nvarchar of the specified target column. (System.Data)
String or binary data would be truncated. (System.Data)
When I look at the rows in Excel, I see nothing different. I cleaned this information before I tried importing it, so it should be the same. I first tried this with an uncleaned file, and got a similar error.
These are the two files in question, I put back slashes to separate the cells:
F58D68CFA3C0433E\ electric_bike\ 1/24/2021 18:56\ 1/24/2021 19:14\ Lincoln Ave & Waveland Ave\ 13253\ Broadway & Wilson Ave\ 13074\ 41.94881667\ -87.67528067\ 41.96492333\ -87.65843033\ casual\
A6D826302872815D\ electric_bike\ 1/22/2021 15:43\ 1/22/2021 16:15\ Michigan Ave & Jackson Blvd\ TA1309000002\ Broadway & Barry Ave\ 13137\ 41.877752\ -87.62406367\ 41.93764117\ -87.64388967\ member\
The bolded columns are nvarchar(50). Columns 6 and 8 was changed to text because some of the rows contain letters. The others are datetime2 and float.
What do I need to change to get this to work? I have multiple files like this I need to import.
sql-server
import
ssms
importerror
flat-file
0 Answers
Your Answer