Community

Export NULL int to SQL Server

Hello,

I'm using FlexiCapture and I'm trying to export some int value defined in a text Field to a SQL Server database.
Everything is OK when there is a value, but I want it to be NULL in SQL when the field is empty.
I have an error during export : Type does not match
French error is "Exporter vers une base de données compatible ODBC: Le type ne correspond pas."


What i Got :
The DataType of the field is Number
Validation : Can't be empty is unchecked

What I tried

Chek/unckeck the box "treat as text"
Type "NULL" in default value
Launch SQL Server profiler to see what's going on with ODBC but Flexicapture is only getting the columns : it is just getting the table definition and column definitions.

Any ideas ?

Sincerely.
Laurent.

Was this article helpful?

0 out of 0 found this helpful

Comments

3 comments

  • Avatar
    Permanently deleted user
    Hello,

    Type mismatch is happening because integer fields from FlexiCapture are exported as float values.

    Another thing you should be aware of is that if such fields are empty a "0" is exported instead of a null, this is due to float being a non-nullable value type.

    If you need NULLs in your database then check Treat as text option and configure corresponding fields in SQL server to be of nvarchar type.

    Best regards,
    Tim





    0
  • Avatar
    Laurent Pellet
    Hi Tim,

    Thanks for replying on Christmas Day..
    It makes sense, even if in SQL Server, an int or a float can be null : I need NULL when there is no response, and 0 when it's written 0.
    What i've done is to set a calculated column in SQL server defined as cast(X as int) where X is the exported field.
    So a NULL value stays NULL, and is not converted to 0.

    I wish you all the best for the upcoming year.
    Laurent
    0
  • Avatar
    Permanently deleted user

    Hi Laurentp,

       Are you using customized script to export ? if not then how you did manage this

    "What i've done is to set a calculated column in SQL server defined as cast(X as int) where X is the exported field."

     

    Kind Regards

    Ibrar Shah

    0

Please sign in to leave a comment.