SSIS 2008 mySQL source to SQL 2008 - mysql

I need to copy data from a remote mySQL database into MSSQL Server 2008 database using SSIS 2008 package. I have some Timestamp fields in the mySQL database giving me problems. When l excluded the Timestamp fields l managed to copy the data nicely. On the OLE DB Destination Input - Input Columns the field which is Timestamp on mySQL database is showing as having data type DT_Bytes.
I am getting the error An OLE DB record is available.
Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."
[OLE DB Destination [784]] Error: Cannot create an OLE DB accessor. Verify that the column metadata is valid.
My select statement to the mySQL source has got a select case to handle 0 dates it is like;
SELECT case modified_date when day(modified_date) = 0 then '1990-01-01 00:00:00' else modified _date end as modified from mySQLTableName

The problem is definitely with your data types. Open up your Destination component for editing. Go the mapping tab. Hover over each column mapping, first the source column, then the destination. The tooltip will show you what the data types of each column are. One of them doesn't match.
It's most likely your timestamps field, but it might not be, so I won't speculate.
In any case, to make them match, add a Data Transformation component in between your source and destination, and recast the offending source column to the data type you want for inserting into SQL Server. (If the recasting also causes an error, it'll be a lot more helpful one than this one!)

Related

SSIS - Performing Lookup on MS Access datatypes Long Text (NTEXT) and Doubles (DT_R8)

I have an MS Access table that is currently holding several tables with columns that have Long Text (that are set as NTEXT in SSIS) and Doubles (that are set as DT_R8). Data migration (Update and Insert) between this Access DB and a SQL Server DB will be occurring a number of times for the next year or so, and so I'm trying to write an SSIS package in order to perform the data migration and I'm having difficulties with those data types.
This is the process I want to perform:
OLE DB Source (MS Access) -> Lookup -> (other dataflow actions) -> OLE DB Destination (SQL)
However, when I try to perform the Lookup, I'm getting the BLOB error and Float error (understandably). I've tried OLE DB Source (MS Access) -> Data conversion -> Lookup -> OLE DB Destination (SQL), but the Lookup always references the OLE DB Source data (with the NTEXT and DT_R8 datatypes). I've tried CAST and CONVERT, but those also bring up various different errors in their own right. So I'm not exactly sure what to do now.
Any guidance or ideas would be welcomed.

SSIS: cannot convert between unicode and non-unicode string data types

I am working in SQL Server 2008 and BIDS (SSIS). I have a simple data flow task in which I'm importing a flat file into an OLE DB destination. On the OLE DB destination, I'm getting an error message, stating "cannot convert between unicode and non-unicode string data types".
Now, I know one solution method is to put a data conversion in between the flat file and the OLE DB destination. However, my concern is why this is even happening in the first place. In the connection manager for the given flat file, all columns are string (DT_STR) data types, and the Unicode option is unchecked. Similarly, all columns in the destination table (upon the inspection of the metadata in SSMS) are varchar data types. So, there is no nvarchar-to-varchar mapping going on at all.
Why is SSIS thinking that I have a unicode-to-nonunicode mapping happening? And, is there an easier way to resolve this than inserting a data conversion step for the columns that have this problem?
[Since I don't seem to be allowed to comment on the question, I'm having to put my question here.]
Have you checked the table you're trying to insert the data into to see if the columns in the table are varchar or nvarchar? The SSIS metadata could be out of sync with the database table.

Extract data from Sybase ASE 15 using SSIS 2008 in Unicode format

I'm attempting to use SQL Server Integration Services (SSIS) 2008 R2 to extract data from a Sybase ASE 15 database.
I've managed to configure the OLE DB Source with the correct connection information and can see the tables and data. However no matter what I try it always returns DT_STR columns.
I would like to have the data returned in Unicode format, without using the Derived Column / Data Conversion task, as the destination tables are all defined with NVARCHAR (DT_WSTR) column and it would be a bit of a pain to have to go through every column just to change the type.
Is there a way to define the connection string / set defaults on the login / other method to ensure that the OLE DB Data Source returns DT_WSTR columns instead of DT_STR when running a query?
Many thanks,
John
Right click on the OLE DB Data source and select the Advanced Editor. Then go to the Input and output Properties tab.
Select the column that you're importing and change its dataType on the properties display on the right.
Alternatively you could have your OLE DB Source use a query to return its columns. Your SELECT statement can then CAST() your columns into the type you need.
I don't know why you dont want to use a derived column/data transformation transformation tho. It seems like it would be just the same amount if not more work

How to insert partition view using oledb command or oledb destination (Sql command - data access mode)?

how to write query in OLE DB Command or oledb destination (data access mode - sql command) to insert data to partition view from table/view.
A Partitioned View is something I had no experience with prior to this question. Using the definition provided in the linked article, I came up with this schema and a sample insert to verify I knew I was doing.
I rolled the transaction back so I had no data in my dbo.Year1998Sales view. I then created a new SSIS package. The fact that I used SSIS for SQL Server 2012 will have no bearing on the results, the configuration will be the same.
I created a new package, added a data flow, added an OLE DB Connection Manager and within my Data Flow I have an OLE DB Source wired to an OLE DB Destination.
In my source, I used the same query as in my SQLFiddle demo
SELECT
D.number AS OrderId
, D.number * 100 AS CustomerID
, DATEADD(D, d.number % 365, '1998-01-01') AS OrderDate
, 1+ (D.number % 12) AS OrderMonth
, DATEADD(mm, (D.number % 12), '1998-01-01') AS DeliveryDate
FROM
(
SELECT
ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) -1 AS some_number
FROM
master.dbo.spt_values AS SV
) D (number)
ORDER BY D.number ASC;
I selected dbo.Year1998Sales as the destination and viola, it works. Actually no, it didn't to my amazement. What worked within SSMS errors out in a data flow.
[OLE DB Destination 2] Error: SSIS Error Code DTS_E_OLEDBERROR. An
OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is
available. Source: "Microsoft SQL Server Native Client 11.0"
Hresult: 0x80004005 Description: "Partitioned view
'FOO.dbo.Year1998Sales' is not updatable as the target of a bulk
operation.".
Resolution
The telling portion of this error message is the "target of a bulk operation."
A Data access mode of Table or view - fast load or Table name or view name variable - fast load will result in a bulk insert into the table and generally speaking that is something you will want. However in this case, that isn't possible so one must use the RBAR (row by agonizing row) version of a destination Table or view or Table name or view name variable.
That does work and for smaller data sets, that would be my approach.
Alternative 1
Completely bypass the logical construct of the view and recreate the logic with a conditional split and write to N tables. This would allow you to use bulk updates to the table. However, there's a not insignificant cost associated with replicating that business logic into your package and further maintenance on the package to keep the two in sync. Heaven help you if the logic gets changed in the underlying view and those changes aren't propagated to the package or ported incorrectly. I would not go this route unless I had a bullet-proof business reason for doing so.
Alternative 2
Stage your data. Instead of writing to the partitioned view, write all the data to a staging table in the data flow. Immediately after the data flow, have an Execute SQL Task that pushes the data from the staging table into the View.
While I don't know for certain, my assumption is that this will perform better than Alternative 1 or the original resolution but have not tested. I also don't list this as the primary resolution because I know in some places, like where I work, creating a new table can be rather controversial.

Convert date from access to SQL Server with SSIS

I want to convert a database from access to SQL Server using SSIS. I cannot convert the date/time columns of the access db. SSIS says something like:
conversion between DT_Date and DT_DBTIMESTAMP is not supported.
(Its translated from my German version, might be different in English version). In Access I have Date/Time column, in SQL Server I have datetime. In the dataflow chart of the SSIS I have a OLE DB source for the access db, an sql server target and a data conversion. In the data conversion I convert the columns to date[DT_DATE]. They are connected like this:
AccessDB -> conversion -> SQL DB
What am I doing wrong? How can I convert the Access date columns to SQL Server date columns?
Looks like you'll need to add a specific conversion to convert this column to the correct type. It's the DT_DBTIMESTAMP that you need to convert to, not DT_DATE. Using a Derived Column Transformation for instance, you could use an expression like:
(DT_DBTIMESTAMP)YourDateColumn
You use another Provider on the source side. I used the JET provider. I am doing this on a computer where no Access is installed. When I try to create a data connection using the Office 12.0 Access Database Engine OLE DB Provider I get an error message that the workgroup information file is missing. I get this message on the connection test.
The question is if the conversion depends on the db driver you use to get the data. I cannot install Access on the server I am working, so I cannot try it. Could this be the cause of the problem?
Casting D_Date column to DT_DBTIMESTAMP solve the same problem for me.