Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
419 views
in Technique[技术] by (71.8m points)

sql - FOR XML could not serialize the data for node 'NoName' because it contains a character (0x0002) which is not allowed in XML

My query looks like this:

SELECT 
    ....,
    MAX(ISNULL(LTRIM(RTRIM(estimate.all_estimate)), '')) AS all_estimate,
    ....
FROM 
    workbags 
LEFT OUTER JOIN 
    (SELECT 
         t.workbag_id AS workbag_id, ref_trans_line_id, 
         SUM(ISNULL(total_amt, 0)) all_labor_item_price, 
         STUFF((SELECT ', ' + labor_groups.code + ' - ' + labor_description 
                FROM workbag_labor_issues t1 
                INNER JOIN workbags ON workbags.id = t1.workbag_id 
                INNER JOIN labor_groups ON labor_groups.id = t1.group_id
                WHERE t1.workbag_id = t.workbag_id  
                  AND t1.trans_flag ='A'  
                GROUP BY labor_groups.code, labor_description 
                FOR XML PATH(''), TYPE).value('.', 'nvarchar(max)'), 1, 1, '') all_estimate 
     FROM
         workbag_labor_issues t 
     INNER JOIN 
         workbags ON workbags.id = t.workbag_id
     INNER JOIN 
         labor_groups ON labor_groups.id = t.group_id 
     WHERE 
         t.trans_flag = 'A' 
     GROUP BY 
         t.workbag_id, ref_trans_line_id) estimate ON estimate.workbag_id = workbags.id

I get an error like

FOR XML could not serialize the data for node 'NoName' because it contains a character (0x0002) which is not allowed in XML. To retrieve this data using FOR XML, convert it to binary, varbinary or image data type and use the BINARY BASE64 directive.

Please suggest. Thanks in advance

question from:https://stackoverflow.com/questions/66053484/for-xml-could-not-serialize-the-data-for-node-noname-because-it-contains-a-cha

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...