SSIS Script Task...

Hello Forum Members,

Data comes from upstream systems into Region_Import Table.

The RegionNames are checked with RegionName_Master table and the  new Regions are to be sent as email. After New Region Name is found the RegionName_Master table is updated with the New RegionName. The email from SendMailTask always sends all the RegionNames rather than New RegionName. The #temp file should be dropped before select top1 from #test?

CheckTeamNames Script Task:

SELECT distinct RegionName into #temp
  FROM [Region_IMPORT]
  where RegionName not in (SELECT distinct [RegionName] FROM [RegionName_Master])

 
create table #test (RegionNames varchar(100))
insert into #test
  SELECT STUFF((SELECT ',[' + regionnames  + ']'
FROM #temp
FOR XML PATH (''))
,1,1,'')

Select top 1 * from #test

SendMailTask

[North],[NorthEast],[West],[MidWest]

Kind Regards,

Sqlquery9

August 20th, 2015 6:05pm

Yes, it'll be safe to drop the #temp table after you've inserted to #test and before you query #test

This doesn't sound like something that needs a script task though

Free Windows Admin Tool Kit Click here and download it now
August 20th, 2015 6:33pm

Thanks Ryan. This is already in Prod. I was asked to debug.

Cheers!

August 20th, 2015 6:39pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics