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

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

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

        SQL - 插入一行并返回主键

        时间:2023-10-10

        <tfoot id='iHjm6'></tfoot>

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

                <tbody id='iHjm6'></tbody>
                <bdo id='iHjm6'></bdo><ul id='iHjm6'></ul>
                <legend id='iHjm6'><style id='iHjm6'><dir id='iHjm6'><q id='iHjm6'></q></dir></style></legend>

                  <i id='iHjm6'><tr id='iHjm6'><dt id='iHjm6'><q id='iHjm6'><span id='iHjm6'><b id='iHjm6'><form id='iHjm6'><ins id='iHjm6'></ins><ul id='iHjm6'></ul><sub id='iHjm6'></sub></form><legend id='iHjm6'></legend><bdo id='iHjm6'><pre id='iHjm6'><center id='iHjm6'></center></pre></bdo></b><th id='iHjm6'></th></span></q></dt></tr></i><div id='iHjm6'><tfoot id='iHjm6'></tfoot><dl id='iHjm6'><fieldset id='iHjm6'></fieldset></dl></div>
                  本文介绍了SQL - 插入一行并返回主键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在有主键的表中插入了一行数据.如何将一个选择"刚刚插入的第一行的主键?

                  I have inserted a row with some data in a table where a primary key is present. How would one "SELECT" the primary key of the row one just inserted?

                  我应该更具体地提到我目前使用 SQLite.

                  I should have been more specific and mentioned that I'm currently using SQLite.

                  推荐答案

                  对于 MS SQL Server:

                  For MS SQL Server:

                  SCOPE_IDENTITY() 将返回最后生成的身份您当前范围内的价值:

                  SCOPE_IDENTITY() will return you the last generated identity value within your current scope:

                  SELECT SCOPE_IDENTITY() AS NewID
                  

                  这篇关于SQL - 插入一行并返回主键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何从sqlite3中获取所选结果的行数? 下一篇:我可以在 sqlite3 中使用表名的参数吗?

                  相关文章

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

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