Lookup transformation between DB2 packed decimal and SQL Server DT_NUMERIC in SSIS - sql

We use DB2 as our main production database, but we use SQL Server for many other things i.e. to do integration between other customers and vendors via EDI etc.
I have a table in SQL with SO numbers and I try to make a lookup in DB2 to get all the invoices for the SO's in my table, so here's what I did.
Created a connection to the DB2 using the Microsoft® OLEDB Provider for DB2
Created a data fllow with a source using a SQL Server connection.
Added a Data Conversion Transformation trying to convert the INT so value to a decimal with a precision of 12, but I couldn't change a precision in a DT_DECIMAL, so the only datatype that I have the option to change the precision is DT_NUMERIC.
Added a lookup transformation to lookup the data withing DB2.
Now when i try to create the join between the source table and DB2 I get an error Cannot map the input column, 'so', to the lookup column, 'orno', because the data types do not match.
According to Microsoft this is not a bug and they suggest to use the DT_NUMERIC where you can change the precision.
If I try to convert the SO to a DT_DECIMAL without changing the precision I'd get the same error mentioned above.
Is there any way to work around the limitations from SSIS and change the precision in a DT_DECIMAL conversion so I could do the match?
Or any other suggestions?

The simple answer is to change the connection property in the DB2 connection to treat DECIMAL as NUMERIC.
See bellow

Related

PowerQuery ODBC Connection - DataSource.Error: decimal value out of range - SQL Query

I created a ODBC connection through PowerQuery. The value column is causing the following error:
DataSource.Error: The ODBC driver returned a decimal value for column X, that we couldn't understand or is out of range.
It seems that the errors are caused mostly by values of around 0 with more than 6 decimal when the data is loaded directly to PowerQuery. If I load the connection directly to an excel table, there are no errors.
The SQL code I am using is simply selecting the desired columns with couple of conditions (SELECT, FROM, WHERE). I am not adept with SQL yet.
Is there a some kind of Format or Rounding I can apply to the selected value column directly in the query so that the data is transformed in a format that PowerQuery is able to read before being loaded to PowerQuery?
Or any other possible solutions to fix this error?
Any input is appreciated.
Thank you.

Postgresql REAL type conversion separator

Postgresql cannot automatically convert float point data that comes from remote table in format "1,1"
I am trying to connect db2 and postgresql using some fdw extensions. Now I am using odbc_fdw, but odbc always return float types in format "1,1" and postgresql can only use point as delimiter. may be any postgresql settings or odbc configs?
SELECT CAST('1,01000000E+1' as real);
Error code 22P02. Wrong syntax for type real
I expect to automatically convert strings like "1,1" to float using cast. I think without this I won't be able to user foreign tables with float data types
you could do
SELECT string_to_array('1,01000000E+1', ',')::real[]

colon(:) and dot(.) as millisecond separator in datetime2

I have migrated a Sybase database to SQL server 2008.
The main application that using the database trying to set some of dateTime2 column with data like 1986-12-24 16:56:57:81000 which is giving this error:
Conversion failed when converting date and/or time from character string.
Running the same query using dot(.) instead of colon(:) as millisecond separator like 1986-12-24 16:56:57.81000 or limiting the milliseconds to 3 digits like 1986-12-24 16:56:57:810 will solve the problem.
NOTE:
1- I don't have access to the source of application to fix this issue and there are lots of table with the same problem.
2. Application connect to database using ODBC connection.
Is there any fast forwarding solution or should i write lots of triggers on all tables to fix it using the above solutions?
Thanks in advance
AS Gordon Linoff said
A trigger on the current table is not going to help because the type
conversion happens before the trigger is called. Think of how the
trigger works: the data is available in a "protorow".
But There is a simple answer!
Using SQL Server Native Client Connection instead of basic SQL Server ODBC connection handle everything.
Note:
1. As i used SQL Server 2008 version 10 of SQL server native client works fine but not the version 11 (it's for SQL Server 2012).
2. Use Regional Settings make some other conversion problem so don't use it if you don't need it.
Select REPLACE(getdate(), ':', '.')
But it will Give String Formate to datetime Which is not covert into DateTime formate
Why would you need triggers? You can use update to change the last ':' to '.':
update t
set col = stuff(col, 20, 1, '.');
You also mistakenly describe the column as datetime2. That uses an internal date/time format. Your column is clearly a string.
EDIT:
I think I misinterpreted the question (assuming the data is already in a table). Bring the data into staging tables and do the conversion in another step.
A trigger on the current table is not going to help because the type conversion happens before the trigger is called. Think of how the trigger works: the data is available in a "protorow".
You could get a trigger to work by creating views and building a trigger on a view, but that is even worse. Perhaps the simplest solution would be:
Change the name and data type of the column so it contains a string.
Add a computed column that converts the value to datetime2.

SQL Developer Data is not compatible with column definition

I'm trying to insert data into my table but I am receiving this error:
"SQL Developer Data is not compatible with column definition or is not available for a nut nullable column"
The column that is getting this error has data of the form 7391DBDF-40D5-E523-80C2-3863BB43AC67.
I believe this is a uniqueidentifer but but I'm not sure how one would insert this datatype into SQL Developer.
nvm: got it. Use Varchar
Same error importing good data into a number column with SQLDeveloper, problem was not specifying precision and scale on the column.
Solved by setting size to 28,0.

Integration Services double to string

I'm using Integration Services to load data from an Excel file to SQL Server table. When I try to send a number stored as double (DT_R8) into a database column where data are stored as varchar(50) I find a queer rounding.
For example consider data in first row first column of above image. Original value is 31.35 but as a string it's stored as shown below
I already tried to use a Delivered Column transformation to cast to string before exporting to SQL, I also added a Round(x, 5) but I get the same result.
How can I solve this problem given that I can't change SQL column data type?
The only working solution was changing the input type from double (DT_R8) to currency [DT_CY]. It seems that the rounding performed on double (DT_R8) make its use difficult when parsing is somehow involved in the export process.