Delete record without using Delete keyword

  • Cldewar (10/19/2010)


    LutzM (10/19/2010)


    Cldewar (10/19/2010)


    How about data disappeared from my table and there are no deletes in any of my procedure. What could have done this?

    I encountered a problem where the delete was run against the wrong table. Took forever to find that one.

    Please don't hijack a thread.

    If you have a question, open a new thread and ask.

    Gail asked why anyone would ask this. This is my suggestion. I do not have any questions.

    Your suggestion is somewhat contradictory:

    Either you have no deletes in any of your procs against this table or there is a proc with a delete against the (wrong) table. A possible reason would be a ad-hoc delete.

    But in any case we'd talk about a delete statement.

    There are ways to hide any trace of an ad-hoc delete if you just have proper permissions and the skills required...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • LutzM (10/16/2010)


    Before going any further I'd like to know the true reason why you don't use the simple DELETE statement.

    Well... imagine we are in the year 2030 and Microsoft is licensing by the statement being "DELETE" one of the most expensive ones 😀

    Most certainly that was an interview question.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • PaulB-TheOneAndOnly (10/19/2010)


    LutzM (10/16/2010)


    Before going any further I'd like to know the true reason why you don't use the simple DELETE statement.

    Well... imagine we are in the year 2030 and Microsoft is licensing by the statement being "DELETE" one of the most expensive ones 😀

    Most certainly that was an interview question.

    I agree regarding the interview stuff. But it was kind of nice to play with it again - just for practice.

    I don't think it'll take much more time anyway before MS starts to charge by the number of SQL statements (which is just one step before charging by the keywords used) 😀

    Actually, that's a pretty fair concept: If there's a DB with complex code it'll be expensive. If it's just a small system it'll cost less.

    And if there are programmers not knowing what to do (e.g. heavy use of any kind of loops) they'd be charged for as well. I might like it 😛



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • LutzM (10/20/2010)


    PaulB-TheOneAndOnly (10/19/2010)


    LutzM (10/16/2010)


    Before going any further I'd like to know the true reason why you don't use the simple DELETE statement.

    Well... imagine we are in the year 2030 and Microsoft is licensing by the statement being "DELETE" one of the most expensive ones 😀

    Most certainly that was an interview question.

    I agree regarding the interview stuff. But it was kind of nice to play with it again - just for practice.

    I don't think it'll take much more time anyway before MS starts to charge by the number of SQL statements (which is just one step before charging by the keywords used) 😀

    Actually, that's a pretty fair concept: If there's a DB with complex code it'll be expensive. If it's just a small system it'll cost less.

    And if there are programmers not knowing what to do (e.g. heavy use of any kind of loops) they'd be charged for as well. I might like it 😛

    Don't put these ideas in their heads! 😀

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Don't worry, if there's an angle to exploit MS will be there on top of the game 😉

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • I came up with the same solution as Lutz and I express the same reservations that Lutz and Gail pointed out.

    A variant of this would be to copy the data into another table conditionally, truncation of the original table, and reinsertion. And as stated previously would be complicated with keys et al

    Director of Transmogrification Services

Viewing 6 posts - 16 through 20 (of 20 total)

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