Reading a CSV file with OPENROWSET ignores the data types


  • I'm using openrwrowset with Microsoft.ACE.OLEDB.12.0 and I'm having the issue that the data types are being derived from a certain number of rows and that's not enough.

    All columns are dollar amounts and most of the first rows, let's say 1st thousand or so have 0 in them. So when I read the CSV file the columns are determined to be integer but should be floats (money would be great but I'm not asking for that).

    So I'm losing my decimals.

    Here's what I'm using:

    OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Text;Database=c:\temp;HDR=Yes;MaxScanRows=0','select * from [somefile.csv] ')


    Thursday, May 05, 2011 3:41 PM


All replies