The Worst Advice

  • Besides what GilaMonster had already mentioned - directly changing data in the system tables (sql 2000).

  • dmoldovan (7/13/2009)


    Besides what GilaMonster had already mentioned - directly changing data in the system tables (sql 2000).

    Oh yeah, that's always fun. Often the consequences are only noticed after upgrading to 2005.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • rf44 (7/12/2009)


    Maybe I should precise that I never intended to promote or even condone the use of cursors. I know that cursors are not efficient tools in MS SQL Server (to say the least! It's another story in Oracle, though).

    What I meant was that the answer "Never... etc." was inadequate because:

    1) It does not answer the question (when I ask "What time is it?' I do not expect an answer such as "Take an umbrella, it's going to rain").

    2) It is not educative or even helpful because it does not provide an explanation (would it be a short one) of why a cursor should not be used, and if it does not provide a better alternative for performing the same action (if it's possible).

    Regards.

    Heh... ok... I get the point you're trying to make and I absolutely agree with you. Saying "Never use a cursor" is bad because there actually are places where even someone like myself would condone their use. And like Lynn said, most of us who could be labeled as "anti-cursor" and "anti-RBAR" do take the time to not only explain, but to find out more to help the OP avoid a possible performance trap.

    To continue your analogy, the funny part is that when someone does ask "What time is it?", the more correct answer might just be "You're gonna die! Time to get in the boat, NOW!" Folks just have to remember that saying something like "You should never use a cursor" without any backup in the form of useful alternate code is pretty much useless just like you say.

    --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)
    Intro to Tally Tables and Functions

  • In any case, there is a lot worse advice out there than “Never use Cursors”. In the world of bad advice, it’s kind of fail-safe bad advice that probably won’t cause much damage.

    It probably won’t foul people up as much as something like “Never use stored procedures” or “Never use DRI” or “Add the user to the local admins group to solve security issues”.

  • John Rowan (7/10/2009)


    cs_troyk (7/10/2009)


    Michael Valentine Jones (7/10/2009)


    John Rowan (7/10/2009)


    cs_troyk (7/10/2009)


    "Denormalize for performance" and its sibling "You only need to normalize to 3NF".

    😉

    Ha! I'll have to second that one. Not just in forums, but this one runs rampant in development shops.

    When people say they “Denormalized for Performance”, that’s code for “I have no idea how to normalize a database, so when someone complains that the database isn’t normalized, I say it was Denormalized for Performance.”

    Too true... all you have to do is ask to see the "fully normalized" design that it was derived from -- there never is one.

    Exactly, so asking the question of how much performance improvement they got from the 'denormalizations' usually brings a dumbfounded look. These types of 'denormalizations' are, as you said, not derived from a fully normalized model; rather, they are guessed at and justified by saying it was done for performance. I don't even like the term denormalized. It is either normalized or not! I think I am going to start using the phrase 'Spreadsheetized' in place of 'denormalized'.

    We 'Spreadsheetized' it for performance!

    We like to say it is either normalized or "Abbey Normalized" in lu of the superb quote from Young Frankenstein.

  • Michael Valentine Jones (7/13/2009)


    In any case, there is a lot worse advice out there than “Never use Cursors”. In the world of bad advice, it’s kind of fail-safe bad advice that probably won’t cause much damage.

    It probably won’t foul people up as much as something like “Never use stored procedures” or “Never use DRI” or “Add the user to the local admins group to solve security issues”.

    Especially when those are followed up with ..."don't worry - LinQ will handle all that nonsense".

    I usually then resort to my own form of worse advice ("use a spreadsheet - you will be much happier there").

    ----------------------------------------------------------------------------------
    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?

  • "The mind acts like an enemy for those who do not control it.”..

    Tame your enemy..! Do not abandon yourself..! and witness the result..

    You will get a bright sun.. when you seek light in the darkness...

    Mind is a TOOL..

    I know this is not a perfect answer...though it is perfect!

  • user was wanting to verify that an error didn't occur when he received this advice:

    "SQL will ALWAYS complete a command before moving on to the next one."

    from

    http://bytes.com/groups/ms-sql/82251-go-used-stored-procedure

Viewing 8 posts - 46 through 52 (of 52 total)

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