I am trying to export a SQL Server database using SQL Server's Import and Export Wizard (SQL Server 2008 R2). The database schema gets created fine in the destination PostgreSQL database and so does most of the data. It only crashes when I try to export a column which has a NULL value in the first row:
Error 0xc020844b: Data Flow Task 22: An exception has occurred during data insertion, the message returned from the provider is: Kan een object van het type System.Int32 niet converteren naar het type System.Char[].
(SQL Server Import and Export Wizard)
Unfortunately the relevant exception is in Dutch, but it says it can't convert an object of type System.Int32 to System.Char[]. The type of the column in the original SQL Server schema is int and integer in the resulting PostgreSQL database.
This only happens when the value of a column in the first row is NULL. I think it tries to infer the type of the data based on the first value of the column and defaults to System.Char[] if the first value is NULL. Is there any way to change this behaviour and let the type of the data be inferred in the same way as the type of the resulting PostgreSQL column (because it does that correctly)?