How can I set column type when using SqlBulkCopy to insert into a sql_variant column
问题 I'm using SqlBulkCopy to insert/update from a .net DataTable object to a SQL Server table that includes a sql_variant column. However SqlBulkCopy insists on storing DateTime values put into that column as sql type 'datetime' when what I need is 'datetime2'. My DataTable is defined like this: DataTable dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn("VariantValue", typeof(object))); //this represents my sql_variant column Then I throw some data in there that requires a