0

私はSQLを持っています

SELECT '' AS "dfn", CCFKeyType AS "dfn/b", GroupID AS "dfn/var",  ID AS "dfn/code"
FROM (
...
) A

FOR XML PATH('')

AND 生成する

<dfn>
   <b>cid</b>
   <var>0115</var>
   <code>EXS</code>
</dfn>

私は生成したい:

<dfn>
   <b>cid</b>
   (<var>0115</var>):
   <code>EXS</code>
</dfn>

タグ間にテキストデータを挿入するにはどうすればよいですか?

4

1 に答える 1

1
SELECT  ''     AS "dfn"    , 
        'cid'  AS "dfn/b"  ,
        '('    AS "dfn"    ,
        '0115' AS "dfn/var",
        '):'   AS "dfn"    ,
        'EXS'  AS "dfn/code"
FOR XML PATH('')

出力:

<dfn>
    <b>cid</b>
    (<var>0115</var>):
    <code>EXS</code>
</dfn>
于 2013-06-05T20:30:17.560 に答える