• <small id='jJ6rH'></small><noframes id='jJ6rH'>

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

        如何从 SQL Server 中的值列表中进行选择

        How can I select from list of values in SQL Server(如何从 SQL Server 中的值列表中进行选择)
        • <bdo id='3bbiZ'></bdo><ul id='3bbiZ'></ul>

          <small id='3bbiZ'></small><noframes id='3bbiZ'>

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

                  <tbody id='3bbiZ'></tbody>

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

                2. 本文介绍了如何从 SQL Server 中的值列表中进行选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个非常简单的问题,我无法解决.我需要做这样的事情:

                  I have very simple problem that I can't solve. I need to do something like this:

                  select distinct * from (1, 1, 1, 2, 5, 1, 6).
                  

                  有人可以帮忙吗??

                  编辑

                  数据来自我们的一位客户的文本文件.它完全没有格式化(它是一行很长的文本),但在 Excel 中可能会这样做.但这对我来说并不实用,因为我需要在我的 sql 查询中使用这些值.每次需要运行查询时都这样做很不方便.

                  The data comes as a text file from one of our clients. It's totally unformatted (it's a single, very long line of text), but it may be possible to do so in Excel. But it's not practical for me, because I will need to use these values in my sql query. It's not convenient to do so every time I need to run a query.

                  推荐答案

                  获取一长串逗号分隔文本的不同值的最简单方法是使用 find an replace with UNION 以获得不同的值.

                  Simplest way to get the distinct values of a long list of comma delimited text would be to use a find an replace with UNION to get the distinct values.

                  SELECT 1
                  UNION SELECT 1
                  UNION SELECT 1
                  UNION SELECT 2
                  UNION SELECT 5
                  UNION SELECT 1
                  UNION SELECT 6
                  

                  应用于您的逗号分隔文本的长行

                  Applied to your long line of comma delimited text

                  • 找到并用 UNION SELECT
                  • 替换每个逗号
                  • 在语句前添加SELECT

                  您现在应该有一个有效的查询

                  You now should have a working query

                  这篇关于如何从 SQL Server 中的值列表中进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Building a comma separated list?(建立一个逗号分隔的列表?)
                  Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column(尽管每列都使用了 varchar(MAX),但在导入 CSV 文件时 SQL Server 中出现错误)
                  How can I import an Excel file into SQL Server?(如何将 Excel 文件导入 SQL Server?)
                  Export table to file with column headers (column names) using the bcp utility and SQL Server 2008(使用 bcp 实用程序和 SQL Server 2008 将表导出到带有列标题(列名称)的文件)
                  Concat field value to string in SQL Server(将字段值连接到 SQL Server 中的字符串)
                  SQL Server Bulk insert of CSV file with inconsistent quotes(SQL Server 批量插入带有不一致引号的 CSV 文件)

                3. <legend id='naX0w'><style id='naX0w'><dir id='naX0w'><q id='naX0w'></q></dir></style></legend>

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

                          <tbody id='naX0w'></tbody>

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

                          • <bdo id='naX0w'></bdo><ul id='naX0w'></ul>
                            <tfoot id='naX0w'></tfoot>