I know there is an abundance of information out there regarding what i am trying to do, and i have tried many of them with no luck. I am sure it is something simple i am missing. As usual, suggestions are gratefully welcomed !
I am using INTERSECT to find the duplicated between 2 tables. I am obtaining the @@ROWCOUNT and assigning it to a column. The query is such:
USE edgp GO SELECT @@RowCount as RCD1 FROM ( SELECT [txpid] ,[txpname] ,[txpadd1] ,[txpadd2] ,[txpcity] ,[txpst] ,[txpzip] ,[txphone] ,[txp_contac] ,[txpdba] ,[txp_begin] ,[phyadd1] ,[phyadd2] ,[phycity] ,[physt] ,[phyzip] ,[naic] ,[naic_desc] ,[Month] FROM edgp.DBO.EconDev_NewBusinessLicenses_Geocoded INTERSECT SELECT [txpid] ,[txpname] ,[txpadd1] ,[txpadd2] ,[txpcity] ,[txpst] ,[txpzip] ,[txphone] ,[txp_contac] ,[txpdba] ,[txp_begin] ,[phyadd1] ,[phyadd2] ,[phycity] ,[physt] ,[phyzip] ,[naic] ,[naic_desc] ,[Month] FROM edgp.DBO.EconDev_NewBusinessLicenses_2016 ) D; SELECT @@RowCount as [RCD]
The control flow is very simple, if duplicates exist, do not merge and exit. If all values are unique, merge to the master data set.
I have set the execute SQL task general section as such:
Result set, i have created a variable User::RowCountDuplicate as int32 with value 0 (zero). I have tried the value 0 and RCD as the Result Name, neither worked.
Based on the @@ROWCOUNT, i have set up constraint and expression:
When executing, this is the output I get:
SSIS package "C:\Users\oliver\documents\visual studio 2010\projects\NBL\NBL\Merge.dtsx" starting.
Error: 0x0 at Execute INTERSECT to detect duplicates before merging, want to avoid multi-merges of same dataset: No result rowset is associated with the execution of this query.
Error: 0xC002F309 at Execute INTERSECT to detect duplicates before merging, want to avoid multi-merges of same dataset, Execute SQL Task: An error occurred while assigning a value to variable "RowCountDuplicate": "Exception from HRESULT: 0xC0015005".
I think that covers it. Again, I appreciate the help !