UPDATE account_master.dbo.accounts
SET
accounts.[LastName] = sfaccounts.LastName
,accounts.[FirstName] = sfaccounts.firstname
,accounts.[Salutation] = sfaccounts.salutation
,accounts.[date_created] = sfaccounts.createddate
,accounts.[creator_id] = ''
,accounts.[date_modified] = sfaccounts.lastmodifieddate
,accounts.[modifier_id] = ''
,accounts.[PersonBirthdate] = sfaccounts.personbirthdate
,accounts.[fundgroup] = sfaccounts.fund_group__c
,accounts.[marital_status] = sfaccounts.marital_status__c
,accounts.[patient_ssn] = sfaccounts.patient_ssn__c
,accounts.[Annual_Household_Income] = cast([Annual_Household_Income__c] as float)
,accounts.[Household_Size] = sfaccounts.household_size__c
,accounts.[Sex] = sfaccounts.sex__c
,accounts.copay_override = sfaccounts.copay_override__c
,accounts.[Backdate_Flag] = case when [Backdate__c]='true' then 1 else 0 END
,accounts.[Grace_period_flag] = case when [grace_period__c] ='true' then 1 else 0 END
,accounts.grace_override = grace_period_override__c
,accounts.[freeze_flag] = case when [assistance_freeze__C]='true' then 1 else 0 END
,accounts.termination_flag = case when termination_flag__c='true' then 1 else 0 END
,accounts.application_complete = sfaccounts.application_complete__c
,accounts.application_complete_date = sfaccounts.application_complete_date__c
,accounts.[Final_Approval] = sfaccounts.final_approval__c
,accounts.[Compliant] = sfaccounts.compliant__c
,accounts.[Noncompliant_Reason] = sfaccounts.noncompliant_reason__c
,accounts.[noncompliant_valid] = sfaccounts.noncompliant_valid__c
,accounts.[noncompliant_date] = sfaccounts.noncompliant_date__c
,accounts.[copay_status] = sfaccounts.status__c
,accounts.[therapy] = sfaccounts.therapy__c
,accounts.termination_reason = sfaccounts.termination_reason__c
,accounts.lisa = sfaccounts.lisa__c
,accounts.pharmacy_id = sfaccounts.pharmacy_id__c
-- keys
,accounts.salesforce_id = sfaccounts.id
,accounts.related_pharmacy_id = sfaccounts.related_pharmacy__c
,accounts.previous_pharmacy_id = sfaccounts.previous_pharmacy__c
FROM
sf.dbo.account sfaccounts
WHERE
accounts.AccountID = sfaccounts.account_id__c
|