I have a table (DE in SFMC) with the following schema
Incoming_data
Id -- Text(40)
Data_Json -- Text(4000)
The field Data_Json contains data in JSON format. Sample data shown below
ID DATA_JSON
------------------ ----------------------------------------------------------------------------------
123456 {'EMPLOYEE_ID':'12345678','EMPLOYEE_DEPT':'SALES', 'EMPLOYEE_START_DATE':'2022-08-01','EMPLOYEE_HIRE_DATE':'2022-07-15','EMPLOYEE_NAME':'TEST','EMPLOYEE_DEPT_NO':1,'EMPLOYEE_DEPT_CAT':'SL_LOB', 'EMPLOYEE_EMAIL_ADD':'ABCTEST@DOESNOTEXIST.ca','EMPLOYEE_TYPE':'F'}
222333 {'EMPLOYEE_ID':'13578912','EMPLOYEE_START_DATE':'2022-09-01','EMPLOYEE_HIRE_DATE':'2022-08-15','EMPLOYEE_NAME':'TEST2','EMPLOYEE_EMAIL_ADD':'TEST2@DOESNOTEXIST.ca','EMPLOYEE_TYPE':'C'}
444555 {'EMPLOYEE_ID':'23134587','EMPLOYEE_START_DATE':'2022-11-15','EMPLOYEE_HIRE_DATE':'2022-10-15','EMPLOYEE_NAME':'TEST3','EMPLOYEE_EMAIL_ADD':'TEST3@DOESNOTEXIST.ca','EMPLOYEE_TYPE':'P'}
666777 {'EMPLOYEE_ID':'44555678','EMPLOYEE_DEPT':'MARKET', 'EMPLOYEE_START_DATE':'2022-06-01','EMPLOYEE_HIRE_DATE':'2022-05-15','EMPLOYEE_NAME':'TEST4','EMPLOYEE_DEPT_NO':3,'EMPLOYEE_DEPT_CAT':'PT_MAKT', 'EMPLOYEE_EMAIL_ADD':'TEST4@DOESNOTEXIST.ca','EMPLOYEE_TYPE':'F'}
Using SQL, How to modify the EMPLOYEE_DEPT_NO
field in the DATA_JSON
to add single quotes to the data
I.e. how to add single quotes to as below
'EMPLOYEE_DEPT_NO':'3'
Any help is much appreciated
I want the value of attribute inside JSON to be encoded with single quotes