• <i id='x2rjD'><tr id='x2rjD'><dt id='x2rjD'><q id='x2rjD'><span id='x2rjD'><b id='x2rjD'><form id='x2rjD'><ins id='x2rjD'></ins><ul id='x2rjD'></ul><sub id='x2rjD'></sub></form><legend id='x2rjD'></legend><bdo id='x2rjD'><pre id='x2rjD'><center id='x2rjD'></center></pre></bdo></b><th id='x2rjD'></th></span></q></dt></tr></i><div id='x2rjD'><tfoot id='x2rjD'></tfoot><dl id='x2rjD'><fieldset id='x2rjD'></fieldset></dl></div>

        <bdo id='x2rjD'></bdo><ul id='x2rjD'></ul>
      <tfoot id='x2rjD'></tfoot>

      <small id='x2rjD'></small><noframes id='x2rjD'>

    1. <legend id='x2rjD'><style id='x2rjD'><dir id='x2rjD'><q id='x2rjD'></q></dir></style></legend>

        将字段值连接到 SQL Server 中的字符串

        时间:2023-10-10
        • <tfoot id='u4Bh1'></tfoot>

        • <i id='u4Bh1'><tr id='u4Bh1'><dt id='u4Bh1'><q id='u4Bh1'><span id='u4Bh1'><b id='u4Bh1'><form id='u4Bh1'><ins id='u4Bh1'></ins><ul id='u4Bh1'></ul><sub id='u4Bh1'></sub></form><legend id='u4Bh1'></legend><bdo id='u4Bh1'><pre id='u4Bh1'><center id='u4Bh1'></center></pre></bdo></b><th id='u4Bh1'></th></span></q></dt></tr></i><div id='u4Bh1'><tfoot id='u4Bh1'></tfoot><dl id='u4Bh1'><fieldset id='u4Bh1'></fieldset></dl></div>
              <tbody id='u4Bh1'></tbody>

            <small id='u4Bh1'></small><noframes id='u4Bh1'>

              <legend id='u4Bh1'><style id='u4Bh1'><dir id='u4Bh1'><q id='u4Bh1'></q></dir></style></legend>
                • <bdo id='u4Bh1'></bdo><ul id='u4Bh1'></ul>
                  本文介绍了将字段值连接到 SQL Server 中的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要一个与 SQL Server 中的 Oracle WM_CONCAT 类似的函数,它返回一个逗号分隔的列表,其中包含您将其作为参数传递的任何字段.例如,在 Oracle 中,

                  I need a similar function to Oracle WM_CONCAT in SQL Server, which returns a comma separated list of whatever field you pass it as argument. For example, in Oracle,

                  select WM_CONCAT(first_name) from employee where state='CA' 
                  

                  返回约翰、吉姆、鲍勃".

                  returns "John, Jim, Bob".

                  如何在 SQL Server 中执行此操作?

                  How can I do this in SQL Server?

                  谢谢

                  推荐答案

                  在SQL Server 2017中增加了STRING_AGG函数

                  In SQL Server 2017 STRING_AGG function has been added

                  SELECT t.name as TableName
                        ,STRING_AGG(c.name, ';') AS FieldList
                    FROM sys.tables t
                    JOIN sys.columns c 
                      ON t.object_id = c.object_id
                    GROUP BY t.name;
                  

                  这篇关于将字段值连接到 SQL Server 中的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:SQL Server 批量插入带有不一致引号的 CSV 文件 下一篇:使用 bcp 实用程序和 SQL Server 2008 将表导出到带有列标题(列名称)的文件

                  相关文章

                  <small id='ITIAJ'></small><noframes id='ITIAJ'>

                  <i id='ITIAJ'><tr id='ITIAJ'><dt id='ITIAJ'><q id='ITIAJ'><span id='ITIAJ'><b id='ITIAJ'><form id='ITIAJ'><ins id='ITIAJ'></ins><ul id='ITIAJ'></ul><sub id='ITIAJ'></sub></form><legend id='ITIAJ'></legend><bdo id='ITIAJ'><pre id='ITIAJ'><center id='ITIAJ'></center></pre></bdo></b><th id='ITIAJ'></th></span></q></dt></tr></i><div id='ITIAJ'><tfoot id='ITIAJ'></tfoot><dl id='ITIAJ'><fieldset id='ITIAJ'></fieldset></dl></div>

                • <tfoot id='ITIAJ'></tfoot>
                    <bdo id='ITIAJ'></bdo><ul id='ITIAJ'></ul>
                  <legend id='ITIAJ'><style id='ITIAJ'><dir id='ITIAJ'><q id='ITIAJ'></q></dir></style></legend>