Click here to Skip to main content
15,905,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am Importing an excel file to sql server 2000 through the following query
INSERT INTO [tblName] 
SELECT * FROM OPENROWSET 
('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=D:\New Folder\ExcelName.xlsx;HDR=YES', 'select * from [Sheet1$]') ;


I am getting data like 3.23646e+007 in a particular column.While selecting through
the following query
SELECT * FROM OPENROWSET 
('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=D:\New Folder\ExcelName.xlsx;HDR=YES', 'select * from [Sheet1$]') ;

Data are normal like 84431673

I am using varchar(100) as datatype and also i tried with increased length.

Advance Thanks for the solutions.
Posted
Updated 5-Jul-11 20:58pm
v2
Comments
Soft009 3-Aug-11 7:30am    
Try using nvarchar(100) as the datatype......

In excel sheet where ever we have number column please append single quotes (') before the number starts

e.g.

actual value 123456789
change it to '123456789

Then try importing the excel file.
 
Share this answer
 
v2
Comments
Prasanna ragav 6-Jul-11 2:33am    
Thanks 2irfanshaikh. I tried this but did not get the answer.
[no name] 6-Jul-11 2:41am    
can u copy and paste some test data on the screen
I incluede IMEX=1 in the connection string and that solved my problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900