0

I'm trying to bulk upload from an Excel file using the following query:

BULK INSERT TempRevenueForecast 
   FROM 'E:\RevenueTracker\Demo\UserTemplate.xls' 
   WITH (FORMATFILE = 'E:\RevenueTracker\Demo\TRF.FMT');
GO

But, I'm getting this error:

Bulk load data conversion error (truncation) for row 1, column 2

How can I solve it?

1

1 Answer 1

0

If you open the table TempRevenueForecast in edit mode (right-click-table - edit top 200 rows) in SSMS, you can just copy-paste the excel data over.

That's a very handy feature of SSMS.

Otherwise, use OpenRowSet:

INSERT INTO [TempRevenueForecast ] ([Column1], [Column2], [Column3], [Column4])

SELECT A.[Column1], A.[Column2], A.[Column3], A.[Column4]
FROM OPENROWSET 
('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=E:\RevenueTracker\Demo\UserTemplate.xls;HDR=YES', 'select * from [Sheet1$]') AS A;

For that to work, the Microsoft Access Database Engine (ACE) components must be installed.
http://www.microsoft.com/en-us/download/details.aspx?id=23734
or
http://www.microsoft.com/en-us/download/details.aspx?id=13255

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.