SSIS MYSQL to SQL Datatype - sql-server

I'm trying to copy data from MySQL to SQL Server 2008.
My SSIS is generating error for time (DBTime) column in MySQL database. (cannot convert dbtime to dbtime2)
What datatype can i use in SQL server for time? I tired nvarchar, varchar and also tried data conversion task but i get same error.

You could use time or datetime.
EDIT:
Now that I see the type of data that MySQL uses for time what you probably want to do is to put the data into an nvarchar on the SQL Server side, and in SSIS you can invoke
TIME_FORMAT(timecol, '%H:%i:%S')
The SSIS tool lets you do specifications of how to manipulate individual columns before inserting into the other database using scripting.

Related

Is there a way to map the NUMBER field in Oracle to multiple numeric fields in SQL Server in SSIS

I'm trying to move data from Oracle to SQL Server. We have a large number of NUMBER fields in the original Oracle 11g schema. In SSIS, we are using an OLE destination control. Most of the NUMBER fields are mapping to float fields.
We are using the attunity connectors. I understand that there are mapping xml files in SSIS that will map numeric data types to SSIS data types; however, I need something that will take a sample of the data and infer the correct numeric, sql server destination data type.
Is there a solution for this problem? There are a lot of fields, we are worried about manually mapping them.
Thanks!

INSERT to Oracle table from SQL Server database link

I have created a database link to SQL Server 2012 database in Oracle 11gR2 using the Oracle Gateway for SQL Server. The connection is working fine and I am able to run queries and stored procedure from SQL Server.
The problem arises when I try to retrieve an XML column from SQL Server. Oracle documents clearly states that if database is in UTF character set (AL32UTF8), XML is supported, but in LONG datatype format.
I am able to query the XML column by
SET LONG 5000;
select "XMLColumn" FROM "xmltable"#sqlserver;
but while trying to insert this into an oracle table with Long datatype it gives the following error.
SQL Error: ORA-00997: illegal use of LONG datatype
Is there any workaround for this problem.
I even tried to convert the incoming XML to CLOB as suggested by Sanders, which perfectly makes sense. But somehow that too throws back the same error. In below query Name is obviously the XML column from SQL Server.
CREATE TABLE TEMPCLOB
AS
SELECT TO_LOB("Name") AS "Name" FROM "xmldata"#sqlserver;
LONG is deprecated datatype in Oracle. You can spend time to this problem, but I'd advice you to convert it immediately into CLOB or XMLTYPE and have no problem at all.

Converting FoxPro Date type to SQL Server 2005 DateTime using SSIS

When using SSIS in SQL Server 2005 to convert a FoxPro database to a SQL Server database, if the given FoxPro database has a date type, SSIS assumes it is an integer type. The only way to convert it to a dateTime type is to manually select this type. However, that is not practical to do for over 100 tables.
Thus, I have been using a workaround in which I use DTS on SQL Server 2000 which converts it to a smallDateTime, then make a backup, then a restore into SQL Server 2005.
This workaround is starting to be a little annoying.
So, my question is: Is there anyway to setup SSIS so that whenever it encounters a date type to automatically assume it should be converted to a dateTime in SQL Server and apply that rule across the board?
Update
To be specific, if I use the import/export wizard in SSIS, I get the following error:
Column information for the source and the destination data could not be retrieved, or the data types of source columns were not mapped correctly to those available on the destination provider.
Followed by a list of a given table's date columns.
If I manually set each one to a dateTime, it imports fine.
But I do not wish to do this for a hundred tables.
You could make a small FoxPro program that will loop through your list of tables and write out a SQL INSERT INTO statement for each record to a .sql file which you could then open from or paste into SQL Management Studio and execute. You could then control the date formats that will work with SQL Server's date type fields.
Something similar could be done in c#.

Why does ADO NET Source Show incorrect string data types by default?

I'm new to SSIS and I created a simple Data Flow task. The ADO NET Source shows all my varchar columns in ADO NET Source Output -> Output columns as Unicode string [DT_WSTR]. This is incorrect. The table in Sql Server uses only varchar columns. I tried to add a Data Conversion transformation, but I still get errors about converting unicode strings. Why is SSIS reading my table schema incorrectly?
Thanks!
DT_WSTR is an SSIS datatype which I think SSIS covert's to if working on it. Though I don't know why it is in this case.
My recommendation would be to try using the OLEDB source and destination - they seem to have much more power and flexibility in SSIS.

SQLBulkCopy can't convert Time to DateTime

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.
I assume you are dealing with pre-SQL Server 2008. SQL Server 2008 has DATE and TIME data types.
I think you would have to use a DataTable which matched the SQL Server schema and load this from your source reader, appropriately changing any TIME to a DATETIME by adding date information (e.g. 1/1/1900). Then use WriteToServer(DataTable). You might want to do it in batches, since you may use a bunch of memory reading it all into a DataTable.
Any particular reason you can't use SSIS?

Resources