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

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

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

      1. <tfoot id='USTcu'></tfoot>

        SQL Server Management Studio 2012 中的自动增量主键

        时间:2023-07-17

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

              <i id='ov87Z'><tr id='ov87Z'><dt id='ov87Z'><q id='ov87Z'><span id='ov87Z'><b id='ov87Z'><form id='ov87Z'><ins id='ov87Z'></ins><ul id='ov87Z'></ul><sub id='ov87Z'></sub></form><legend id='ov87Z'></legend><bdo id='ov87Z'><pre id='ov87Z'><center id='ov87Z'></center></pre></bdo></b><th id='ov87Z'></th></span></q></dt></tr></i><div id='ov87Z'><tfoot id='ov87Z'></tfoot><dl id='ov87Z'><fieldset id='ov87Z'></fieldset></dl></div>
            • <legend id='ov87Z'><style id='ov87Z'><dir id='ov87Z'><q id='ov87Z'></q></dir></style></legend><tfoot id='ov87Z'></tfoot>
                  <tbody id='ov87Z'></tbody>
                  <bdo id='ov87Z'></bdo><ul id='ov87Z'></ul>
                  本文介绍了SQL Server Management Studio 2012 中的自动增量主键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我如何auto increment primary keySQL Server 数据库表中,我看过论坛但可以不知道如何.

                  How do I auto increment the primary key in a SQL Server database table, I've had a look through the forum but can't see how.

                  我查看了属性但看不到选项,我看到了一个答案,您可以转到 Identity 规范属性并将其设置为 yes 并设置 Identity将 增加到 1,但该部分是灰色的,我无法将 no 更改为 yes.

                  I've looked the the properties but can't see an option, I have seen an answer where you go to the Identity specification property and set it to yes and set the Identity increment to 1, but that section is grayed out and I can't change the no to yes.

                  一定有一种简单的方法可以做到这一点,但我找不到.

                  There must be a simple way to do this but I can't find it.

                  推荐答案

                  确保Key列的数据类型为int,然后手动设置identity,如图

                  Make sure that the Key column's datatype is int and then setting identity manually, as image shows

                  或者运行这段代码

                  -- ID is the name of the  [to be] identity column
                  ALTER TABLE [yourTable] DROP COLUMN ID 
                  ALTER TABLE [yourTable] ADD ID INT IDENTITY(1,1)
                  

                  代码将运行,如果 ID 不是表中唯一的列

                  the code will run, if ID is not the only column in the table

                  图像参考先进先出

                  这篇关于SQL Server Management Studio 2012 中的自动增量主键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:插入多行而不重复“INSERT INTO ...";声明的一部分? 下一篇:Integrated Security = True 和 Integrated Security = SSPI 有什么区

                  相关文章

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

                    • <bdo id='eYUc8'></bdo><ul id='eYUc8'></ul>

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

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