Forum Discussion
Importing Data from Excel to SQL table
I do have all my columns set to nvarchar and still getting the truncation error. Any other ideas?
- 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?
- Jan 24, 2019
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
- Tim HunterJan 29, 2019Steel Contributor
After doing a little further testing, I figured out that the SQL table column did not like the ' character in my Excel column. Is there an SQL Data Type that will accept the ' so I don't have to remove them all from Excel? Thank you!