Hi.
I'm working on updating a QV script that someone created for me, but now I'm managing. I'd like to be able to have our SQL Load script reference an external SQL script file from inside of the SQL Load script.
Here is a mock template of what we have now. I'd like lines 6 thought 10 to be an external SQL script. We update this script routinely on a separate server that feeds other QV apps. By having one centralized Department Naming script, we don't have to change each QV load script.
SQL
with cohort as
(
Select
Patient_ID,
VISIT_KEY,
DEPARTMENT_NAME,
DEPARTMENT_KEY,
CASE WHEN DEPARTMENT_NAME =
(several conditions to rename and categorize the departments)
END AS "Location"
[Several other colums]
FROM
{Series of Joins]
Where
)
SELECT
Patient_ID
VISIT_KEY,
DEPARTMENT_NAME,
DEPARTMENT_KEY,
"Location"
FROM cohort
[Joins]
Thus, lines 6-10 would like this in a separate script file.
Select
DEPARTMENT_NAME,
DEPARTMENT_KEY,
CASE WHEN DEPARTMENT_NAME =
(several conditions to rename and categorize the departments)
END AS "Location"
[Several other colums]