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

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

        SQL SERVER:获取两个日期之间的总天数

        SQL SERVER: Get total days between two dates(SQL SERVER:获取两个日期之间的总天数)

          <bdo id='llEXB'></bdo><ul id='llEXB'></ul>

          <legend id='llEXB'><style id='llEXB'><dir id='llEXB'><q id='llEXB'></q></dir></style></legend>

            <tfoot id='llEXB'></tfoot>
              <tbody id='llEXB'></tbody>
              1. <small id='llEXB'></small><noframes id='llEXB'>

                <i id='llEXB'><tr id='llEXB'><dt id='llEXB'><q id='llEXB'><span id='llEXB'><b id='llEXB'><form id='llEXB'><ins id='llEXB'></ins><ul id='llEXB'></ul><sub id='llEXB'></sub></form><legend id='llEXB'></legend><bdo id='llEXB'><pre id='llEXB'><center id='llEXB'></center></pre></bdo></b><th id='llEXB'></th></span></q></dt></tr></i><div id='llEXB'><tfoot id='llEXB'></tfoot><dl id='llEXB'><fieldset id='llEXB'></fieldset></dl></div>
                • 本文介绍了SQL SERVER:获取两个日期之间的总天数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试获取两天之间的总天数:

                  I'm trying to get the total number of days between two days:

                  1/1/2011
                  3/1/2011
                  
                  RETURN
                  62
                  

                  是否可以在 SQL Server 中进行?

                  Is it possible to do in SQL Server?

                  推荐答案

                  PRINT DATEDIFF(DAY, '1/1/2011', '3/1/2011') will give you what you之后.

                  PRINT DATEDIFF(DAY, '1/1/2011', '3/1/2011') will give you what you're after.

                  这给出了两个日期之间跨越午夜边界的次数.如果您将两个日期都包括在计数中,您可能决定需要在其中加一个 - 如果您不想包括任何一个日期,则减去一个.

                  This gives the number of times the midnight boundary is crossed between the two dates. You may decide to need to add one to this if you're including both dates in the count - or subtract one if you don't want to include either date.

                  这篇关于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 文件)
                    <tbody id='DAbo6'></tbody>
                  <legend id='DAbo6'><style id='DAbo6'><dir id='DAbo6'><q id='DAbo6'></q></dir></style></legend>

                    • <bdo id='DAbo6'></bdo><ul id='DAbo6'></ul>
                    • <small id='DAbo6'></small><noframes id='DAbo6'>

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