• <legend id='5pfEW'><style id='5pfEW'><dir id='5pfEW'><q id='5pfEW'></q></dir></style></legend>

      <bdo id='5pfEW'></bdo><ul id='5pfEW'></ul>

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

      <small id='5pfEW'></small><noframes id='5pfEW'>

      1. <tfoot id='5pfEW'></tfoot>

        varchar 值如何存储在 SQL Server 数据库中?

        How are varchar values stored in a SQL Server database?(varchar 值如何存储在 SQL Server 数据库中?)

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

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

                <tbody id='TO5vC'></tbody>

                  本文介绍了varchar 值如何存储在 SQL Server 数据库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的程序员同事对他的团队领导提出了一个奇怪的要求;他坚持要创建长度为 16*2nvarchar 列.

                  My fellow programmer has a strange requirement from his team leader; he insisted on creating varchar columns with a length of 16*2n.

                  这种限制有什么意义?

                  我可以假设短字符串(例如少于 128 个字符)直接存储在表的记录中,从这个角度来看,限制将有助于对齐记录中的字段,较大的字符串存储在数据库中heap",并且只有对这个字符串的引用保存在表记录中.

                  I can suppose that short strings (less than 128 chars for example) a stored directly in the record of the table and from this point of view the restriction will help to align fields in the record, larger strings are stored in the database "heap" and only the reference to this string is saved in the table record.

                  是这样吗?

                  这个要求有合理的背景吗?

                  Is this requirement has a reasonable background?

                  顺便说一句,DBMS 是 SQL Server 2008.

                  BTW, the DBMS is SQL Server 2008.

                  推荐答案

                  就我所见,完全没有意义的限制.假设标准 FixedVar 格式(与行/页压缩或稀疏列使用的格式相反)并假设您正在谈论 varchar(1-8000)

                  Completely pointless restriction as far as I can see. Assuming standard FixedVar format (as opposed to the formats used with row/page compression or sparse columns) and assuming you are talking about varchar(1-8000) columns

                  所有 varchar 数据都存储在行尾的可变长度部分(如果行不适合,则存储在 offrow 页面中).它在该部分消耗的空间量(以及它是否以行结束)完全取决于实际数据的长度,而不是列声明.

                  All varchar data is stored at the end of the row in a variable length section (or in offrow pages if it can't fit in row). The amount of space it consumes in that section (and whether or not it ends up off row) is entirely dependant upon the length of the actual data not the column declaration.

                  SQL Server 将在分配内存时使用列声明中声明的长度(例如,用于 sort 操作).它在该实例中做出的假设是 varchar 列将是 平均填充到其声明大小的 50%,因此在选择大小时这可能是一个更好的选择.

                  SQL Server will use the length declared in the column declaration when allocating memory (e.g. for sort operations). The assumption it makes in that instance is that varchar columns will be filled to 50% of their declared size on average so this might be a better thing to look at when choosing a size.

                  这篇关于varchar 值如何存储在 SQL Server 数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  How do I split flat file data and load into parent-child tables in database?(如何拆分平面文件数据并加载到数据库中的父子表中?)
                  Import / Export database with SQL Server Server Management Studio(使用 SQL Server Server Management Studio 导入/导出数据库)
                  How do you import a large MS SQL .sql file?(如何导入大型 MS SQL .sql 文件?)
                  SQL variable to hold list of integers(用于保存整数列表的 SQL 变量)
                  Crystal Reports vs. Microsoft SQL Server Reporting Services(Crystal Reports 与 Microsoft SQL Server Reporting Services)
                  The report definition has an invalid target namespace rsInvalidReportDefinition(报告定义具有无效的目标命名空间 rsInvalidReportDefinition)

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

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

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