0
votes

When exporting data from SQL Server to Excel, when a field size is large e.g. nvarchar(4000) or nvarchar(max) might cause the error below:

INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=c:\DataExport.xls;', 'SELECT * FROM [Sheet1$]') 
SELECT * FROM DataExport_Table

Msg 8152, Level 16, State 4, Line 1
String or binary data would be truncated.
The statement has been terminated.

1
When exporting data from SQL Server to Excel this is a true ?? - Yogesh Sharma
When exporting data from SQL Server to Excel. this is a true -->>Yes - Suraj Mane
Did you just read this question stackoverflow.com/questions/52477920/… and repost the answer? - squillman
Actually this guy is my friend and we both are looking for ans. and we both get above ans but we want better ans. adding row is not good solution. - Suraj Mane

1 Answers

0
votes

Solution worked for me:

Inserted dummy data into the first 8 rows of the Excel speadsheet for the large field columns , which fixed the problem.