Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

HASHBYTES MD5 - problem

$
0
0
Hi,I run into a problem while loading data into DataVault. I create my dv key with HASHBYTES('MD5', <business key>)The load failed due 'Duplicate data' error and the duplicate key being: 0x1f9f0d70785734c03a78ec6336779fAnd the data within (from the log): Arvopaperilaji (Arvopaperilaji:UniChar.100:): "Kotimaiset osakaslainat, kiint." Value_date (Value_date:Date:): "10/31/2016 00:00:00.000000000"First I naturally checked whether there indeed was duplicate data coming from my STG-->DV view - NOWhat is found in DV with the key in question? select * from [VAKAVARAISUUS_PO].[RDV_Arvopaperi_Arvostusero_POSITIO_H] where dv_key = 0x1f9f0d70785734c03a78ec6336779f dv_key [b]dv_load_dts[/b] dv_src [b]Arvopaperilaji [/b] Value_date 0x1F9F0D70785734C03A78EC6336779F [b]2016-11-09 12:47:18.0000000[/b] CSV [b]Kotimaiset osakaslainat, kiint.[/b] 2016-10-31But the data coming from STG to DV now: SELECT CAST(HASHBYTES('MD5', '2016-10-31' + ' # ' + LTrim(Rtrim('Kotimaiset osakaslainat, kiint.'))) AS VARBINARY(40)) dv_key dv_key 0x1F9F0D70785734C03A78EC6336779F[b]00[/b]Notice the extra '00' at the end of the key. This does not matter with Sql (it seems that EVEN number of 'zeroes' can be added to the end of the varbinary)But the thing is that the ETL tool (Informatica 9.6) Lookup comparison considers them different and thus of course a duplicate error arises in the database while inserting.I know I have to investigate the Informatica side of the inquiry (is there a workaround) as well but in here (SqlServer) I'd like to ask 1. Why do I get the '00' to the end compared to the result of '2016-11-09'?2. The string is 100% the same but the source is CSV file - can it be that there is something not visible to my I that causes this (what computer was used to create the CSV)?Regards, VilleSql Server 2014

Viewing all articles
Browse latest Browse all 3145

Trending Articles