Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2004
    Location
    Australia
    Posts
    183

    Angry Unanswered: delete a field help?

    I have a user who has submitted a survey twice, and I have to delete the second entry.
    But every user has a UserID and the data for the second submission has the same UserID (the only thing different is the fact she submitted data 5 seconds later)as this is one of the unique values used in many tables.
    So I have deleted data in other tables but If I try to delete it from this particulat table I can't as I am really trying to delete that ID, so how can I get rid off that record?

  2. #2
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    You don't have a primary key on that field with a unique constraint? (something like an identity column?)

    If you don't have anything to uniquely identify the record, you will have to select one of the records into a temp table, delete the record, then insert the record back. There really isn't any other way to do it.
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  3. #3
    Join Date
    Feb 2004
    Location
    Australia
    Posts
    183
    UserId has an indentity set, but not in the table that it references to,it is not the primary key.

    Could you explain a bit more what would I need to do, as I have only done regular delitions,where things go smooth.

    I will attach a file with the error eventhough you probabaly know what it is

    Thanks for help

    I forgot to tell you that the record I am trying to delete it from is in a view,don't konw if that makes any difference?
    Attached Files Attached Files
    Last edited by zobernjik; 04-28-04 at 02:09.

  4. #4
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    Can you post the table structure of the table you're trying to delete from and the table that's not letting you delete?
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  5. #5
    Join Date
    Feb 2004
    Location
    Australia
    Posts
    183
    ok,viewSurveySubmission is where the double record is and RelocateeServices will not let me delete it.
    Attached Files Attached Files

  6. #6
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    You need to find where the problem is in the base tables and delete the record from there. The view will try to delete from both tables, which it cannot do because another record is still using one of the records from a table you are trying to delete from. Make sense?

    In this case find the duplicate in the base table and delete that record.
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  7. #7
    Join Date
    Feb 2004
    Location
    Australia
    Posts
    183
    Thanks to all willing to help,but I have actually been able to do it myself.

    Thanks

Posting Permissions

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