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 |
jingleheimer76
Starting Member
1 Post |
Posted - 2007-04-17 : 17:52:51
|
I'm doing an openrowset query on an excel sheet. (Using SQL Server 2005) Everything works great, except that I have one column that has both numeric and text data in the spreadsheet. The query returns that column as datatype varchar but puts nulls in the rows that have numeric data in the spreadsheet. Any suggestions?I run: select * from openrowset('microsoft.jet.oledb.4.0', 'Excel 8.0;database=[filepathandname], 'select * from [Sheet1$A4:G5000]')on spreadsheet data that looks like: Model_id Model_name . . . 123 t4556 124 x225 125 455 . . .and get something like . . . . Model_id Model_name . . . 123 t4556 124 x225 125 NULL . . . |
|
mfemenel
Professor Frink
1421 Posts |
Posted - 2007-04-17 : 19:30:09
|
Can you format the data in the sheet and put a leading apostrophe ' in front of the rows with numeric/text data. The apostrophe should force it to treat the field as text data. Then you can do what you want when you pull it into sql server.Mike"oh, that monkey is going to pay" |
 |
|
|
|
|