Try to get values from xml variable in single column from CCC tag, num attribute.
DECLARE @XML XML = '
<FileId global_id="1234">
<file id="12bb"><vd>3</vd>
<pl_b type_b ="222" k="222" name="bbb"></pl_b>
<period from="2019-04-01" to="2019-06-30"></period>
<all>2</all>
<CCC num = "123" />
<CCC num = "444" />
</file>
</FileId>'
Expected Result:
|num|
|---|
|123|
|444|
Now I can get only one value:
SELECT
F.[File].value(N'(CCC/@num)[1]', 'nvarchar(100)') as acc
FROM (VALUES (@XML)) V (X)
CROSS APPLY V.X.nodes('/FileId/file') F([File]);
The problem is it's unknown how many values can be get from xml. In example 2 values also may be 2 two thousand. Second question is how can extract how many values in CCC tag, num attribute?