Forum Discussion
Importing Data from Excel to SQL table
It would seem that you have one or more characters that are not being recognized by the code page you are using. Change data type for destination column to nvarchar(xx) Unicode. That should do it I suspect.
I do have all my columns set to nvarchar and still getting the truncation error. Any other ideas?
- Pio-BalistoyJan 24, 2019Copper ContributorAS Christian pointed out, it may not be an issue on the data type but on the collation. There is a character on the excel that is not recognized by the Collation of the database/Instance. You can check the Description column on the Ticket worksheet. You can workaround this by changing the column/table/database collation for the destination. Or re save/import the excel file to a compatible encoding.
- Tim HunterJan 24, 2019Steel Contributor
Thanks again for your feedback and help! I have tried the Description column in my Excel as both Text and General but still does not work. My description column in SQL table is nvarchar(1500), should I be using a different Data Type on the column in SQL? Or is there a better way to save my Excel spreadsheet before importing?
- Christian_McGheeJan 24, 2019Copper Contributor
Hmm,
Rather than trying to troubleshoot you Collation problem lets see if we can fix this another way. Try Saving the excel file to a .csv. From Excel: File>Export>Change File Type>Save As. Then using the "SQL server Import Export Wizard" select as the "Source" a "Flat File Source" from the drop down list and browse to the location of your saved .csv. Make sure when browsing you tell it to look for the .csv file extension because it defaults to .txt. Then as your destination select "SQL Server Native Client 11.0" from the drop down list. After clicking Next you should be able to edit the mappings and destination data types as desired. Other wise its a bit hard to trouble shoot without hands on access. Let me know if this works
tim @Pio