Results 1 to 5 of 5

Thread: Duplicate Rows When using insert into....

  1. #1
    Join Date
    Feb 2006
    Location
    Nebraska
    Posts
    7

    Duplicate Rows When using insert into....

    While I am working on the tutorial at SQLCourse.com I am using the following:

    Code:
    insert into jftest_1025 (first, last, title, age, salary)
    values ('Jonie', 'Weber', 'Secretary', 28, 19500.00);
    While this does insert the record into the table, Sometimes (actually most of the time), it creates two identical records rather than just one. I am doing something incorrect or is it just a bug with the SQL Interpreter?

    JF

  2. #2
    Join Date
    Oct 2005
    Posts
    2,557
    How are you writing the script to do this? If you use either of these:

    insert into jftest_1025 (first, last, title, age, salary)
    values ('Jonie', 'Weber', 'Secretary', 28, 19500.00);

    insert into jftest_1025 (first, last, title, age, salary)
    values ('Jonie', 'Weber', 'Secretary', 28, 19500.00)
    /

    --then the statement is run once. If your code looks like this:

    insert into jftest_1025 (first, last, title, age, salary)
    values ('Jonie', 'Weber', 'Secretary', 28, 19500.00);
    /

    --then it will be run twice

  3. #3
    Join Date
    Feb 2006
    Location
    Nebraska
    Posts
    7

    Duplicate rows

    Quote Originally Posted by stecal
    How are you writing the script to do this? If you use either of these:

    insert into jftest_1025 (first, last, title, age, salary)
    values ('Jonie', 'Weber', 'Secretary', 28, 19500.00);

    insert into jftest_1025 (first, last, title, age, salary)
    values ('Jonie', 'Weber', 'Secretary', 28, 19500.00)
    /

    --then the statement is run once. If your code looks like this:

    insert into jftest_1025 (first, last, title, age, salary)
    values ('Jonie', 'Weber', 'Secretary', 28, 19500.00);
    /

    --then it will be run twice
    I wrote it like:

    Code:
    insert into jftest_1025 (first, last, title, age, salary)
    values ('Jonie', 'Weber', 'Secretary', 28, 19500.00);
    and it entered each row twice (most of the time). Does it make a difference if you press the enter key prior to using the submit button on the SQL Interperter?

  4. #4
    Join Date
    Feb 2006
    Posts
    4
    hello
    just started the 'course' too.... well, first I thought I may input twice, but I have the same proble than JF: i re-created a new table, and all input is twice in the table... (which causes problems for the next exercises....

    tia

    cheers,
    bs

    PS: I input one by one, like:

    insert into my_table
    (first, last, titel, age, salary)
    values ('jonie', 'Weber', 'secretary', 28, 19599.00);

  5. #5
    Join Date
    Feb 2006
    Posts
    4
    so.... don't knwo what happened, but:

    i deleted all my recs, and input one by one again, after each input i checked, and it appeared to be inputted ONCE this time. The last one appeared the 3 times, i just deleted these 3 lines and input the last one again, now all is 'unique'...

    must be a little bug?

Posting Permissions

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