I am writing a small utility to copy a database from a proprietary ODBC database into a SQL Server database. Everything is working great, except when I use SQLBulkCopy to copy over the data. It works in most cases, but not when it's trying to copy a TIME field into a SQL DATETIME. I get this error:
The given value of type TimeSpan from the data source cannot be converted to type datetime of the specified target column.
When I create the schema in SQL Server I have to make the DATE and TIME fields DATETIME types in SQL Server, so there is no way around this. I wanted to use SQLBulkCopy so I didn't have to manually read through every record in every table and wrap logic around the special cases. Before I go down that road, is there another way I can do this? I have no control at all on the source database schema or content.