Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- RT.Id, RT.manager_id, RT.worksite_id, RT.hire_reason_id, RT.ref, RT.notes, RT.can_claim_expenses, RT.[State]
- ,JA.org_unit_id, JA.job_position_id
- -- ,RA.credential_type_id, RA.[rank], RA.essential
- -- ,OA.OA_id, OA.contract_type, OA.n_vacancies
- FROM OPENJSON(@JSON)
- WITH
- (
- id INT
- ,manager_id INT
- ,worksite_id INT
- ,hire_reason_id INT
- ,ref NVARCHAR(500)
- ,notes NVARCHAR(500)
- ,can_claim_expenses NVARCHAR(50)
- ,[state] NVARCHAR(50)
- ,identifiers NVARCHAR(50)
- ,job_attributes NVARCHAR(MAX) AS JSON
- ) RT
- CROSS APPLY OPENJSON (RT.job_attributes)
- WITH
- (
- org_unit_id INT
- ,job_position_id INT
- ,requirements_attributes NVARCHAR(MAX) AS JSON
- ) JA
- CROSS APPLY OPENJSON (JA.requirements_attributes)
- WITH
- (
- credential_type_id INT
- ,[rank] INT
- ,essential BIT
- ,openings_attributes NVARCHAR(MAX) AS JSON
- ) RA
- /* --Uncomment #1
- CROSS APPLY OPENJSON (RA.openings_attributes)
- WITH
- (
- OA_id INT '$.id'
- ,contract_type NVARCHAR(50)
- ,n_vacancies INT
- ,rostered_shifts_attributes NVARCHAR(MAX) AS JSON
- ) OA
- */
- /* --Uncomment #2
- CROSS APPLY OPENJSON (OA.rostered_shifts_attributes)
- WITH
- (
- id INT
- ,starts_at datetime
- ,ends_at datetime
- ,notes NVARCHAR(500)
- ,on_call BIT
- )
- RSA
- */
- `
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement