0

I'm having a big problem getting data from Excel files via connection String. I connect to xls file and execute this query:

SELECT CDbl(COLUMN_NAME) FROM [SHEETNAME$]

when COLUMN_NAME references a string column (or numeric column with empty cells), it fails. There is any solution? like "ISNULL(COLUMN_NAME, 0)" or someting like that???

Thanks!

1 Answer 1

1

Add the property IMEX=1 at the end of your connection string of the Excel connection manager.

Samples:

http://www.connectionstrings.com/excel

This will treat mixed data types as string. However, Excel will only scan the first 8 rows to determine if there are intermixed data types. In order to change that, you need to modify the TypeGuessRows registry setting for the JET provider. If you set it to 0, it will scan all rows.

Here are more references:


Sign up to request clarification or add additional context in comments.

1 Comment

Yes, I know the property but my problem is that I NEED to manage this columns like number (currency). So my idea is to force the column type to numeric or another one but NO string. Thank you anyway!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.