Force Excel import to fail when there is text in numeric column

  • Hello,

    I've also asked this question here:

    I import excel files via SSIS to a sql server table. In order to get numeric values for a column that sometimes can have no entries or blank cells, I have set 8 template rows at the top with 0,00 to import this as type money.

    What I noticed is, that text entered somewhere in this column will be replaced with NULL in the DB. But instead of NULL I would like the import to fail. To get the user to correct it.

    I also have calculation formulas for that column that can produce blank cells but these I don't mind being imported as NULL (which it does right now).

    Is there a setting in SQL Server or somewhere else that would help me get this job done or is this a tricky task?

    thank you.

  • As far as I'm aware, this isn't possible due to the ridiculous way the Excel driver types each column.

    If you must work with Excel, I'd probably change those template rows to force it to be a string rather than numeric (or use the IMEX=1 parameter in the connection string, to force it to always be text), then convert to a numeric in the data flow, so you have control over what to do in the event of receiving non-numeric data.

  • ok, thanks for the info. I guess that's the only way to do it then.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply