Add EXTERNAL SQL scripts

This commit is contained in:
2026-04-20 14:55:25 +08:00
parent c05ba7ec7e
commit b4979eed82
344 changed files with 61619 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
-- Databricks notebook source
--dwd to dws
--
--- 202108
--PRINT(GETDATE())
---ATC
insert overwrite table dwd.dwd_ims_atc_hierarchy
SELECT * --into DIM_ATC_Hierarchy
FROM (SELECT Therapeutic_ID AS ATC1_ID,
Therapeutic_Code AS ATC1_CODE,
Therapeutic_Name AS ATC1_DES
FROM dwd.dwd_ims_td_therapeutic_class ATC
WHERE ATC. Therapeutic_Level = '1') ATC1
LEFT JOIN (SELECT Therapeutic_ID AS ATC2_ID,
Therapeutic_Code AS ATC2_CODE,
Therapeutic_Name AS ATC2_DES
FROM dwd.dwd_ims_td_therapeutic_class ATC
WHERE ATC. Therapeutic_Level = '2') ATC2
ON ATC1. ATC1_CODE =
LEFT (ATC2. ATC2_CODE, 1)
LEFT JOIN (SELECT Therapeutic_ID AS ATC3_ID,
Therapeutic_Code AS ATC3_CODE,
Therapeutic_Name AS ATC3_DES
FROM dwd.dwd_ims_td_therapeutic_class ATC
WHERE ATC. Therapeutic_Level = '3') ATC3
ON ATC2. ATC2_CODE =
LEFT (ATC3. ATC3_CODE, 3)
LEFT JOIN (SELECT Therapeutic_ID AS ATC4_ID,
Therapeutic_Code AS ATC4_CODE,
Therapeutic_Name AS ATC4_DES
FROM dwd.dwd_ims_td_therapeutic_class ATC
WHERE ATC. Therapeutic_Level = '4') ATC4
ON ATC3. ATC3_CODE =
LEFT (ATC4. ATC4_CODE, 4)
;