Can I implement the following SQL SERVER 2005 query using SYNCSORT. Please reply ASAP.
INSERT INTO #tmp1
SELECT BusinessCode
,1 As SectionType
,ISNULL(MAX(DetailSectionName),'') As DetailSectionName
,StatementDate
,AgentNumber
,ISNULL(GroupID,'')
,PolicyNumber
,NULL As NewBusConv
,MAX(NameOrDescription) As PolicyHolder
,IssueDate
,WritingAgentNumber
,MIN(EffectiveDate) As EffectiveDate
,TranCode
,NULL As PaidToDate
,0 As Duration
,SUM(PremiumAmount) As PremiumAmount
,CommissionRate
,SplitPercentage
,0 As CommissionAmount
,AdvanceRate
,ISNULL(SUM(OriginalAdvance),0) As OriginalAdvance
,0 As Recovery
,0 As Recoup
,0 As AdvanceBalance
,0 As MiscAmount
,0 As MiscYTD
,ISNULL(MAX(PlanDescription),'') AS PlanDescription
,NULL As WritingAgentName
,MAX(Mode) as Mode
FROM Comm_Details_Stag
WHERE BusinessCode = @BusinessCode
AND StatementDate = @StatementDate
AND (TranID = 'IA' or TranID = 'SA' or TranID = 'OA')
GROUP BY BusinessCode
,StatementDate
,GroupID
,AgentNumber
,PolicyNumber
,IssueDate
,WritingAgentNumber
,TranCode
,CommissionRate
,SplitPercentage
,AdvanceRate
,PlanDescription
,DetailSectionName
SELECT BusinessCode
,1 As SectionType
,ISNULL(MAX(DetailSectionName),'') As DetailSectionName
,StatementDate
,AgentNumber
,ISNULL(GroupID,'')
,PolicyNumber
,NULL As NewBusConv
,MAX(NameOrDescription) As PolicyHolder
,IssueDate
,WritingAgentNumber
,MIN(EffectiveDate) As EffectiveDate
,TranCode
,NULL As PaidToDate
,0 As Duration
,SUM(PremiumAmount) As PremiumAmount
,CommissionRate
,SplitPercentage
,0 As CommissionAmount
,AdvanceRate
,ISNULL(SUM(OriginalAdvance),0) As OriginalAdvance
,0 As Recovery
,0 As Recoup
,0 As AdvanceBalance
,0 As MiscAmount
,0 As MiscYTD
,ISNULL(MAX(PlanDescription),'') AS PlanDescription
,NULL As WritingAgentName
,MAX(Mode) as Mode
FROM Comm_Details_Stag
WHERE BusinessCode = @BusinessCode
AND StatementDate = @StatementDate
AND (TranID = 'IA' or TranID = 'SA' or TranID = 'OA')
GROUP BY BusinessCode
,StatementDate
,GroupID
,AgentNumber
,PolicyNumber
,IssueDate
,WritingAgentNumber
,TranCode
,CommissionRate
,SplitPercentage
,AdvanceRate
,PlanDescription
,DetailSectionName