1
내가 데이터웨어 하우스를보고 유형이 변화를 내가 행에 현재까지 유 효이와 동일한 지 확인해야t-SQL 테스트 데이터웨어 하우스 2 형은
올바르게 작동하는지 확인해야합니다 변경 다음 행에 날짜부터 vaild.
이 검사가 종료 된 행이 또한 제대로
감사를 시작되었는지 확인 마크
내가 데이터웨어 하우스를보고 유형이 변화를 내가 행에 현재까지 유 효이와 동일한 지 확인해야t-SQL 테스트 데이터웨어 하우스 2 형은
올바르게 작동하는지 확인해야합니다 변경 다음 행에 날짜부터 vaild.
이 검사가 종료 된 행이 또한 제대로
감사를 시작되었는지 확인 마크
다음은 킴볼 유형 2 차원 테이블에 관련이 있습니다. 이것은 현재 항목에 대한 먼 미래의 날짜로
3000-01-01
을지지 참고.
CustomerKey
은 자동 증가 정수입니다.이 예제는 다음 누락되거나 누락 된 행이있는 목록을 제공해야합니다.
;
with
q_00 as (
select
CustomerKey
, CustomerBusinessKey
, rw_ValidFrom
, rw_ValidTo
, row_number() over (partition by CustomerBusinessKey order by CustomerKey asc) as rn
from dimCustomer
)
select
a.CustomerKey
, a.CustomerBusinessKey
, a.rw_ValidFrom
, a.rw_ValidTo
, b.CustomerKey as b_key
, b.CustomerBusinessKey as b_bus_key
, b.rw_ValidFrom as b_ValidFrom
, b.rw_ValidTo as b_ValidTo
from q_00 as a
left join q_00 as b on b.CustomerBusinessKey = a.CustomerBusinessKey and (b.rn = a.rn + 1)
where a.rw_ValidTo < '3000-01-01'
and a.rw_ValidTo != b.rw_ValidFrom ;
또한 유용
-- Make sure there are no nulls
-- for rw_ValidFrom, rw_ValidTo
select
CustomerKey
, rw_ValidFrom
, rw_ValidTo
from dimCustomer
where rw_ValidFrom is null
or rw_ValidTo is null ;
-- make sure there are no duplicates in rw_ValidFrom
-- for the same customer
select
CustomerBusinessKey
, rw_ValidFrom
, count(1) as cnt
from dimCustomer
group by CustomerBusinessKey, rw_ValidFrom
having count(1) > 1 ;
-- make sure there are no duplicates in rw_ValidTo
-- for the same customer
select
CustomerBusinessKey
, rw_ValidTo
, count(1) as cnt
from dimCustomer
group by CustomerBusinessKey, rw_ValidTo
having count(1) > 1 ;
가 어떻게 다음 행이 무엇인지 알 수 있습니까? 지금까지 뭐 해봤 어? – LittleBobbyTables
나는 동일한 고객 번호를 가지고 있지만 ETL에서 새로운 ID를 얻습니다. 따라서 동일한 고객 번호를 기반으로 테스트해야합니다. –