Hi ,
My requirement is to get data from Server A and put it into ServerB. I have somany joins in the source query and some temp tables if the run the query in ssms it runs fine, but i put the same query in Data flow OLE DB Source task, i receive the error.
Below is my code, its too lareg but i dont think we need to worry about the code at all as its working perfectly fine
Select dbo.hs_claim.hsclaimnumber as Claim_Number, min(HS_PAYMENT_VW.hscheckdate) min_check_date,dbo.hs_claim.hsdatecreated
into ##1
from dbo.hs_claim left outer join dbo.hs_transaction TRANS on hs_claim.hsclaimid = TRANS.hsclaimid
left outer join dbo.HS_TRANSACTION_CODE_VW TCode_VW on TRANS.hstransactioncodeid = TCode_VW.hstransactioncodeid
LEFT OUTER JOIN HS_PAYMENT_VW ON TRANS.hspaymentid = HS_PAYMENT_VW.HSPAYMENTID
where HS_PAYMENT_VW.hsstatus = 'Payment Complete'and TCode_VW.hstransaction = 'Payment'and TCode_VW.hstransactiontype ='Indemnity'
group by dbo.hs_claim.hsclaimnumber,dbo.hs_claim.hsdatecreated
Select distinct dbo.hs_claim.hsclaimnumber as Claim_Number,t.min_check_date,qx_users.fullname as paid_by,s.value Specialty,o.value Office,
integrator.qw_fullname as Integrator,HS_PAYMENT_VW.hsreason,
Payment_Method = case when HS_PAYMENT_VW.hs_eft_payment = 1 then 'EFT' else 'CHECK' END, HS_payee.hstype,
Contact_Date =DATEADD(DAY, CASE DATENAME(WEEKDAY, GETDATE()) WHEN 'Friday' THEN 3 ELSE 1 END, getdate()),upper(rtrim(supervisor.qw_lastname)) as Team,
HS_PAYMENT_VW.hscheckdate as Check_date,HS_PAYMENT_VW.hsreason as Payment_Description,dbo.hs_claim.hsdatecreated,qw_employee.hsspecialty
into ##2
from dbo.hs_claim left outer join dbo.hs_transaction TRANS on hs_claim.hsclaimid = TRANS.hsclaimid
left outer join dbo.HS_TRANSACTION_CODE_VW TCode_VW on TRANS.hstransactioncodeid = TCode_VW.hstransactioncodeid
left outer join dbo.HS_DD_CLAIMSTATUS_VW on hs_claim.hsclaimstatus = HS_DD_CLAIMSTATUS_VW.pkey
LEFT OUTER JOIN HS_PAYMENT_VW ON TRANS.hspaymentid = HS_PAYMENT_VW.HSPAYMENTID
left outer join dbo.hs_transaction_code on TRANS.hstransactioncodeid = hs_transaction_code.hstransactioncodeid
left outer join qx_users ON HS_PAYMENT_VW.hscreatedby = qx_users.loginname
left outer join qw_employee on qx_users.pkey = qw_employee.qw_userid
left outer join HS_DD_OFFICE_VW as O on qw_employee.hsoffice=O.pkey
left outer join HS_DD_SPECIALTY_VW s on qw_employee.hsspecialty = s.pkey
left outer JOIN qw_employee AS Supervisor ON qw_employee.qw_managerid = Supervisor.qw_userid
left outer join hs_payee on HS_PAYMENT_VW.hspaymentid = hs_payee.hspaymentid
left outer join qw_employee as integrator on integrator.qw_userid=dbo.hs_claim.hsintegratorid
inner join ##1 t on t.Claim_Number=dbo.hs_claim.hsclaimnumber and t.min_check_date=HS_PAYMENT_VW.hscheckdate
where HS_PAYMENT_VW.hsstatus = 'Payment Complete'and
TCode_VW.hstransaction = 'Payment'
and TCode_VW.hstransactiontype ='Indemnity' and hstype =1 and integrator.hsspecialty<>68
group by dbo.hs_claim.hsclaimnumber ,qx_users.fullname ,integrator.qw_fullname ,HS_PAYMENT_VW.hsreason,t.min_check_date,supervisor.qw_lastname,
HS_PAYMENT_VW.hs_eft_payment , HS_payee.hstype, s.value,o.value,
HS_PAYMENT_VW.hscheckdate ,HS_PAYMENT_VW.hsreason ,dbo.hs_claim.hsdatecreated,qw_employee.hsspecialty
having convert(date,t.min_check_date,101) =
case
when HS_PAYMENT_VW.hs_eft_payment=1 and datepart (weekday, dateadd( DD, -6, getdate())) in (1,7) then convert(date,DATEADD(dd,-4,getdate()),101)
when HS_PAYMENT_VW.hs_eft_payment=1 and datepart (weekday, dateadd( DD, -6, getdate())) not in (1,7) then convert(date,DATEADD(dd,-6,getdate()),101)
when HS_PAYMENT_VW.hs_eft_payment=0 and datepart (weekday, dateadd( DD, -14, getdate())) not in (1,7) then convert(date,DATEADD(dd,-14,getdate()),101)else null end
SELECT hs_comments.hsDateCreated AS Date_created,dbo.HS_CLAIM.hsClaimNumber CLAIM_NUMBER , dbo.qw_employee.qw_fullname as full_name,hsnote
into ##3
FROM dbo.HS_CLAIM INNER JOIN dbo.hs_comments ON dbo.HS_CLAIM.hsClaimId = dbo.hs_comments.hsobjectid
left outer join qx_users ON
(case when hs_comments.hscreatedby= 'Kpullo' then 'KDavidson'
when hs_comments.hscreatedby= 'LRoss' then 'linette.august'
when hs_comments.hscreatedby= 'ntarry' then 'nnaylor'
when hs_comments.hscreatedby= 'Katee.Flesher' then 'Katee.Parton' else hs_comments.hscreatedby end )
= qx_users.loginname
left outer join qw_employee on qx_users.pkey = qw_employee.qw_userid
WHERE dbo.hs_comments.hsaction in (1) and year(hs_comments.hsdatecreated) >= year(getdate()) and
hs_comments.hsnote like '%PPC%'
select t2.Claim_Number,t2.Check_date as First_ACV_Payment,t2.Contact_Date,t2.specialty,t2.Office,t2.Integrator,t2.paid_by,t2.Payment_Method,t2.Payment_Description,t2.Team,DATEDIFF(day,t2.hsdatecreated,t2.Check_date) as Cycle_Time,t2.hsdatecreated,'QX' AS LoadSource
from ##2 t2
left outer join ##3 t3
on t3.claim_number =t2.claim_number and t2.min_check_date < t3.date_created
where t3.CLAIM_NUMBER is null and year(t2.hsdatecreated)=year(getdate())
order by t3.claim_number asc
drop table ##1
drop table ##2
drop table ##3
The error i receive in Data flow task is "Invalid object Name ##1". May be i need to change the way i am dropping the tables?
Can someone please help me with any suggestions on this?
Thanks