Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2009-04-15 : 15:32:33
|
I am returning data from MS Excel usingselect *FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\myfile.xls;HDR=YES','SELECT * FROM [Sheet1$]')One of the columns has both numeric and text values. When I run the query all the data in that column is NULL unless it had a numeric values.I tied explicityly converting the field like soselect convert(varchar(50),mycol)FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\myfile.xls;HDR=YES','SELECT * FROM [Sheet1$]')But still does not return the text that was in the column.So next I opened the excel doc and formated the column to TEXT, and still the exact same results... Any sugestions? Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-15 : 15:40:47
|
Set your IMEX mode properly. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2009-04-15 : 15:52:24
|
select *FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\myfile.xls;HDR=YES;IMEX=1','SELECT * FROM [Sheet1$]')Did the trick. Thanks! Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881 |
 |
|
|
|
|
|