I have created a linked server to query some CSV files. The query below works with no errors:
SELECT * FROM OPENQUERY(LINKEDSERVER, 'Select * FROM [import.csv]')
There is a field that could contain either an number or text and the query seems to want to treat it strictly as an integer and returns NULL as the values for any records that have text in that field. All of the records that contain numeric data in that field are displaying properly.
My first thought was maybe that I needed to cast or convert that field to a string to make sure that the query returned data regardless of whether it was numeric or text, but I haven't been able to get that to work. Something like:
SELECT * FROM OPENQUERY(LINKEDSERVER, 'Select cast(field1, varchar(50)) as newfield, field2 FROM [import.csv]')
Does anyone have any ideas?