Skip to content

Commit

Permalink
fix len function for compatibility with big query
Browse files Browse the repository at this point in the history
  • Loading branch information
bradmontierth committed Jul 30, 2024
1 parent 4e1986a commit d766935
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions models/intermediate/eligibility_unpivot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ unpivot_medicare_status as (
unpivot_hmo_status as (
select
desy_sort_key
, case when len(month) = 14 then substring(month, 14, 1) -- 'entitlement_buy_in_ind1' -> '1'
when len(month) = 15 then substring(month, 14, 2) -- 'entitlement_buy_in_ind10' -> '10'
, case when LENGTH(month) = 14 then substring(month, 14, 1) -- 'entitlement_buy_in_ind1' -> '1'
when LENGTH(month) = 15 then substring(month, 14, 2) -- 'entitlement_buy_in_ind10' -> '10'
else null end as month
, reference_year as year
, hmo_status
Expand Down Expand Up @@ -90,8 +90,8 @@ unpivot_entitlement as (

select
desy_sort_key
, case when len(month) = 23 then substring(month, 23, 1) -- 'entitlement_buy_in_ind1' -> '1'
when len(month) = 24 then substring(month, 23, 2) -- 'entitlement_buy_in_ind10' -> '10'
, case when LENGTH(month) = 23 then substring(month, 23, 1) -- 'entitlement_buy_in_ind1' -> '1'
when LENGTH(month) = 24 then substring(month, 23, 2) -- 'entitlement_buy_in_ind10' -> '10'
else null end as month
, reference_year as year
, entitlement
Expand Down

0 comments on commit d766935

Please sign in to comment.