Deleting more than one row?!

  • Hi,

    1. open a table data in SQL2005 then select one row

    2. right click on selected row and press delete

    system deletes that record without any problem but when repeating the above scenario for more than one row it shows an error indicating that primary ID of ... (a non selected ID) is not removable

    any idea is appreciated ( I know there's other way to do that easily but I'm just curious about this 😉 )

  • I can't duplicate the error. In other words, I get no error unless certain rows are being used by foreign keys.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff beat me to it - but that does sound an awful lot like a foreign key error.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • There's no foreign key defined:ermm:

    thanks for your replies anyway 🙂

  • Have you created any function, stored procedure, trigger or Constraint for that table. If you have created any of the above for primary key, then also it will give problem.

    Preetha SG

  • preetha.sathyamoorthy (6/8/2008)


    Have you created any function, stored procedure, trigger or Constraint for that table. If you have created any of the above for primary key, then also it will give problem.

    Preetha SG

    That's the case :hehe: there's a function defined. but I wonder why it can be deleted via DELETE query?!

  • Hi

    What does the function do?

    "Keep Trying"

  • I think,the data you deleted with DELETE query is not matched with the function definition.

    Preetha SG

  • Could you post the table definition (and function)?

    Is there a computed column in this table?

    Wilfred
    The best things in life are the simple things

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply