Professional Web Applications Themes

INSERT did not insert correct # of rows. - Microsoft SQL / MS SQL Server

Hi Experts: I use the 2 lines below to replace the contents of table: "action_table" with full contents of table "data_table". (1) TRUNCATE TABLE action_table (2) INSERT INTO action_table SELECT * FROM data_table The problem is that the after the 2 lines is executed, the number of rows in action_table is always more (a few hundreds more) than the original table (data_table) . Anyone can tell me why? Is this the correct way to replace the contents of a table with data from another table? Thanks!...

  1. #1

    Default INSERT did not insert correct # of rows.

    Hi Experts:

    I use the 2 lines below to replace the contents of table: "action_table"
    with full contents of table "data_table".

    (1) TRUNCATE TABLE action_table
    (2) INSERT INTO action_table SELECT * FROM data_table

    The problem is that the after the 2 lines is executed, the number of rows in
    action_table is always more (a few hundreds more) than the original table
    (data_table) . Anyone can tell me why? Is this the correct way to replace
    the contents of a table with data from another table?

    Thanks!


    Polaris Guest

  2. #2

    Default Re: INSERT did not insert correct # of rows.

    Maybe try DROP TABLE action_table if both tables schema are the same.

    Please, someone correct me if I am wrong. Just a nooby here.


    On Sat, 2 Aug 2003 17:24:49 -0700, "Polaris" <com>
    wrote:
     

    Random Guest

  3. #3

    Default Re: INSERT did not insert correct # of rows.

    You might want to check to see if there is any trigger defined on
    action_table. Otherwise, insert/select should give you the same count.

    Also, you could try this, assuming action_table is a stand-alone table.

    drop table action_table
    select *
    into action_table
    from data_table



    --
    -oj
    RAC v2.2 & QALite!
    http://www.rac4sql.net



    "Polaris" <com> wrote in message
    news:phx.gbl... 
    in 


    oj Guest

Similar Threads

  1. Question Insert multiple rows with dynamic data
    By gassmann56560 in forum Coldfusion - Getting Started
    Replies: 0
    Last Post: April 6th, 07:02 PM
  2. MySQL Insert/Multiple Rows
    By SRQ in forum Coldfusion Database Access
    Replies: 5
    Last Post: October 6th, 05:13 PM
  3. Howto insert delete rows into a ASP.net datagrid?
    By Jimmy in forum ASP.NET Data Grid Control
    Replies: 3
    Last Post: April 21st, 04:58 AM
  4. Replies: 5
    Last Post: July 21st, 10:34 AM
  5. Insert 100 rows in just one statement
    By David Portas in forum Microsoft SQL / MS SQL Server
    Replies: 6
    Last Post: July 1st, 12:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139