First of all, I have an empty table in my local database, which looks like this:
CREATE TABLE Dummy(A DATE,
B DATETIME,
C INT
);
*Take note of the date datatype of column A.
Next, I generate a package with a connection manager programatically through
Visual Basic using Microsoft.SqlServer.Dts.Runtime
:
Imports Microsoft.SqlServer.Dts.Runtime
Module Module2
Sub Main()
Dim app As Application = New Application()
Dim package As Package = New Package()
Dim connectionManager As ConnectionManager = package.Connections.Add("OLEDB")
connectionManager.Properties("Description").SetValue(connectionManager,"DESCRIPTION")
connectionManager.Properties("Name").SetValue(connectionManager,"Test")
Dim Provider As String ="SQLOLEDB"
Dim ServerName As String ="DESKTOP-UPN5DLT"
Dim DatabaseName As String ="Test"
connectionManager.ConnectionString ="Data Source="&
ServerName &";Initial Catalog="&
DatabaseName &";Provider="& Provider &";Integrated Security=SSPI;"
app.SaveToXml("C:\Users\zafir\Desktop\Package_3.dtsx", package, Nothing)End SubEnd Module
Next, I open the .dtsx package in Data Tools and add a dataflow with a single OLE DB Destination component.
When I bind the component to the generated connection manager, the datatype for the column A is not recognized, and is set to a default of DT_WSTR of size 10.
All other data types (in this case: datetime & int) are properly recognized.
Now, if I delete the ole db connection manager, and add it manually, it will work like a charm.
I've got the following specs:
- SQL Server 2016
- Data Tools 2015
- DTSRuntimeWrap.dll 12.0.0.0
How do I solve this? This is obviously a problem with the library.