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

    1. <small id='Xf63Y'></small><noframes id='Xf63Y'>

      <tfoot id='Xf63Y'></tfoot>

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

      1. 插入多行而不重复“INSERT INTO ...";声明的一部分?

        时间:2023-07-17

        • <legend id='k0TVW'><style id='k0TVW'><dir id='k0TVW'><q id='k0TVW'></q></dir></style></legend>

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

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

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

                1. 本文介绍了插入多行而不重复“INSERT INTO ...";声明的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我知道我几年前就做过这个,但我不记得语法,而且我在任何地方都找不到它,因为要查阅大量关于批量导入"的帮助文档和文章.

                  I know I've done this before years ago, but I can't remember the syntax, and I can't find it anywhere due to pulling up tons of help docs and articles about "bulk imports".

                  这是我想要做的,但语法不完全正确...请以前做过这件事的人帮帮我:)

                  Here's what I want to do, but the syntax is not exactly right... please, someone who has done this before, help me out :)

                  INSERT INTO dbo.MyTable (ID, Name)
                  VALUES (123, 'Timmy'),
                      (124, 'Jonny'),
                      (125, 'Sally')
                  

                  我知道这是接近正确的语法.我可能在那里需要BULK"这个词,或者什么,我不记得了.有什么想法吗?

                  I know that this is close to the right syntax. I might need the word "BULK" in there, or something, I can't remember. Any idea?

                  我需要这个用于 SQL Server 2005 数据库.我试过这段代码,但无济于事:

                  I need this for a SQL Server 2005 database. I've tried this code, to no avail:

                  DECLARE @blah TABLE
                  (
                      ID INT NOT NULL PRIMARY KEY,
                      Name VARCHAR(100) NOT NULL
                  )
                  
                  INSERT INTO @blah (ID, Name)
                      VALUES (123, 'Timmy')
                      VALUES (124, 'Jonny')
                      VALUES (125, 'Sally')
                  
                  SELECT * FROM @blah
                  

                  我在关键字VALUES"附近发现语法不正确.

                  I'm getting Incorrect syntax near the keyword 'VALUES'.

                  推荐答案

                  INSERT INTO dbo.MyTable (ID, Name)
                  SELECT 123, 'Timmy'
                  UNION ALL
                  SELECT 124, 'Jonny'
                  UNION ALL
                  SELECT 125, 'Sally'
                  

                  对于 SQL Server 2008,可以按照问题中的语句在一个 VALUES 子句中完全做到这一点(您只需要添加一个逗号来分隔每个值语句)...

                  For SQL Server 2008, can do it in one VALUES clause exactly as per the statement in your question (you just need to add a comma to separate each values statement)...

                  这篇关于插入多行而不重复“INSERT INTO ...";声明的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:列“在选择列表中无效,因为它不包含在聚合函数或 GROUP BY 子句中" 下一篇:SQL Server Management Studio 2012 中的自动增量主键

                  相关文章

                  • <bdo id='3pAW6'></bdo><ul id='3pAW6'></ul>

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

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

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