Data from 2 tables is joined and displayed, while displaying I want to split the value of column 'spec 219' to 219 columns
SELECT * FROM
(SELECT *
FROM [CTMS].[dbo].[NUTQCDATA]
WHERE reg_tm >= '20200320000000' and reg_tm <= '20200320235959') a
LEFT JOIN
(SELECT *
FROM [CTMS].[dbo].[MES_IF_ORDER_TRK]) b
ON a.body_no = b.body_no;
Result
.-----------.------------.---------.--------.---------.----------------.----------------.----------.-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
| device_id | body_no | snetchk | stn_cd | stn_seq | stn_dt | reg_date | use_flag | spec219 |
:-----------+------------+---------+--------+---------+----------------+----------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:
| DIAP133 | B4B 078913 | 1 | 3510 | 58 | 20200320020026 | 20200320020300 | 1 | L4RAG 5UJ423A8 P EE13 442BACN21 5116CNT8T3C 1 E212 1 1 32 CBA R 1R1 FA 121 4 5UR2 25NC 2S 12 1S HMC2 3 3 L11 2411 8 T 11 P P B1 GG F C2 BO CG 13 3 ON 1F 18 G R 3 N 4B1D L A C 11 |
'-----------'------------'---------'--------'---------'----------------'----------------'----------'-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
Note, that there are 219 chars including blank space. Blank space also to be assigned in column.
Requirements:
Result should be all columns in Table 1 + all columns in table 2 ('spec 219' to be split to 219 columns)
Assign name for each newly created columns of 'spec 219', Eg: Column 1 = MODEL YEAR, Column 2 = MODEL,...Column 219 = 'SPECIAL DISTRIBUT
spec219column always contain 219 characters, icluding spaces (the data in the question has 178 characters)?SUBSTRING?