Run tool from_plus_to_one_big_string

Back

Description

get a big string like this 'select DISTINCT ' +

' Dbo.GetHeadOrderOn(Contract.ContractID) as FullName, LastName, ' +
'SSNo, ' +
'Voucher.VoucherNumber, ' +
'Voucher.VoucherBeds, ' +
'FirstDay, ' +
'ARAccount.Name As InitialPHA, ' +
'case ' +
' when ARAccount.AdminFeeOverride <> 0 then HAP + URP + ARAccount.AdminFeeOverride ' +
' else ' +
' HAP + URP + ARAccount.AdminFee ' +
'end as IncompleteMonthlyBill, ' +
'HAP, ' +
'case ' +
' when ARAccount.AdminFeeOverride <> 0 then ARAccount.AdminFeeOverride ' +
' else ' +
' ARAccount.AdminFee ' +
'end as AdminFee, ' +
'Contract.EffectiveDate,' +
'MONTH(Contract.EffectiveDate) as Month1,' +
'Case' +
' When MONTH(Contract.EffectiveDate) = 1 then ''January'' ' +
' When MONTH(Contract.EffectiveDate) = 2 then ''February'' ' +
' When MONTH(Contract.EffectiveDate) = 3 then ''March'' ' +
' When MONTH(Contract.EffectiveDate) = 4 then ''April'' ' +
' When MONTH(Contract.EffectiveDate) = 5 then ''May'' ' +
' When MONTH(Contract.EffectiveDate) = 6 then ''June'' ' +
' When MONTH(Contract.EffectiveDate) = 7 then ''July'' ' +
' When MONTH(Contract.EffectiveDate) = 8 then ''August'' ' +
' When MONTH(Contract.EffectiveDate) = 9 then ''September'' ' +
' When MONTH(Contract.EffectiveDate) = 10 then ''October'' ' +
' When MONTH(Contract.EffectiveDate) = 11 then ''November'' ' +
' When MONTH(Contract.EffectiveDate) = 12 then ''December'' ' +
'end as MonthName, ' +
'case ' +
' when ' +
' (((select Count(*) ' +
' from Familymember as FamilyMemberMinor ' +
' inner join Participant on Participant.ParticipantID = FamilyMemberMinor.ParticipantID ' +
' where FamilyMemberMinor.ContractID = Contract.ContractID ' +
' and (DateDiff(year, Participant.Birthdate, Contract.FirstDay) < 18)) >= 3) or ' +
' ((select Count(*) ' +
' from Familymember as FamilyMemberMinor ' +
' where (FamilyMemberMinor.ContractID = Contract.ContractID) and (FamilyMemberMinor.Disabled = 1) ) >=1)) and ' +
' (ContractHCV.InitialPHANew = 1) then ' +
' 75 ' +
' else ' +
' 0 ' +
'end as HardToHouse, ' +

'URP ' +

'from Contract ' +
' inner join Admittance on Admittance.AdmittanceID = Contract.AdmittanceID ' +
' inner join Contract58 on Contract58.ContractID = Contract.ContractID ' +
' inner join FamilyMember on FamilyMember.ContractID = Contract.ContractID AND (Relation = 0) ' +
' inner join Participant on Participant.ParticipantID = FamilyMember.ParticipantID ' +
' inner join ContractHCV on ContractHCV.ContractID = Contract.ContractID ' +
' inner join ARAccount on ARAccount.ARAccountID = ContractHCV.ARAccountInitialPHAID ' +
' Left Outer Join Voucher on Voucher.VoucherID = dbo.GetVoucher(Contract.MasterContractID) ' +

'where (Admittance.Program = 2) ' +
'and PortableStatus = 1 ' +
'and ((GetDate() between Contract.FirstDay and Contract.LastDay)) ' +
'Order BY FullName, Month1'

and get a query ready for Management Studio

Category: SQL

Author: edilio

Please, enter params:

Result