Are the posted questions getting worse?

  • Lynn Pettis - Wednesday, September 12, 2018 3:56 PM

    There is clearly still a long road to go before people default to learning the basics of structured programming before hacking the living daylights out of process flow with gotos.

  • andycadley - Thursday, September 13, 2018 12:53 AM

    Lynn Pettis - Wednesday, September 12, 2018 3:56 PM

    There is clearly still a long road to go before people default to learning the basics of structured programming before hacking the living daylights out of process flow with gotos.

    Like anything else, GOTO can certainly be abused but, like anything else, it does have its uses.

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

  • That may be Jeff but I have seen exactly zero times that a GOTO was needed since sql 2005 when they included TRY/CATCH. In my mind the GOTO is deprecated and should be replaced when encountered.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • I agree. In fact, I'd forgotten that it was even a part of the T-SQL language until this came up.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • GOTO is really disliked by computer scientists: https://en.wikipedia.org/wiki/Considered_harmful
    Dijkstra wanted it to be abolished from all higher level programming languages.
  • Understood on all of that but it is a tool and if you ever need it, you would like it to be available. 

    I will admit that I've not used it for more than a decade and I don't remember the particulars of what I used it for but I do remember going through a peer review about it and getting my butt chewed for its use until the person doing the review finally understood why I was using it.

    Just like Cursors and While loops, "It Depends" comes into play and there are uses for such things even if they only occur once or twice in a decade or two. 😀

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

  • Shifting gears to TRY/CATCH, I think that the way a lot of people use it is wrong, especially in the presence of SET XACT_ABORT ON.  Might be worth an article someday.

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

  • Short why?

    -------------------------------------------------------------------------------------------------------------------------------------
    Please follow Best Practices For Posting On Forums to receive quicker and higher quality responses

  • jonathan.crawford - Thursday, September 13, 2018 9:35 AM

    Short why?

    Sure but my system at work won't allow me to post what I need to explain and I won't be at home until about 10PM tonight.  I'll try to post what I mean after that.

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

  • OMG.  I'm working on a stored procedure that references an EAV table and it has 73 separate subqueries in a single SELECT statement to pull values out of the EAV table.  And that's only the most egregious example.  It also references a couple of other EAV tables.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • drew.allen - Thursday, September 13, 2018 11:44 AM

    OMG.  I'm working on a stored procedure that references an EAV table and it has 73 separate subqueries in a single SELECT statement to pull values out of the EAV table.  And that's only the most egregious example.  It also references a couple of other EAV tables.

    Drew

    But it's fast, right? :D:D:D

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

  • Jeff Moden - Thursday, September 13, 2018 8:23 AM

    Shifting gears to TRY/CATCH, I think that the way a lot of people use it is wrong, especially in the presence of SET XACT_ABORT ON.  Might be worth an article someday.

    The biggest problem i see people doing with TRY/CATCH and this isn't just in SQL Server is that people use it to do exactly what the guy in that post was doing.  No attempt at pre parsing or correcting errors, just throw a bunch of stuff into it and see if it sticks.  Which isn't so much an issue with TRY/CATCH itself, used properly it's very powerful and useful, it just enables some very lazy design practices.

  • ZZartin - Thursday, September 13, 2018 12:10 PM

    The biggest problem i see people doing with TRY/CATCH and this isn't just in SQL Server is that people use it to do exactly what the guy in that post was doing.  No attempt at pre parsing or correcting errors, just throw a bunch of stuff into it and see if it sticks.  Which isn't so much an issue with TRY/CATCH itself, used properly it's very powerful and useful, it just enables some very lazy design practices.

    Agreed.  That's a major part of the "abuse" of TRY/CATCH I've seen.

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

  • ZZartin - Thursday, September 13, 2018 12:10 PM

    Jeff Moden - Thursday, September 13, 2018 8:23 AM

    Shifting gears to TRY/CATCH, I think that the way a lot of people use it is wrong, especially in the presence of SET XACT_ABORT ON.  Might be worth an article someday.

    The biggest problem i see people doing with TRY/CATCH and this isn't just in SQL Server is that people use it to do exactly what the guy in that post was doing.  No attempt at pre parsing or correcting errors, just throw a bunch of stuff into it and see if it sticks.  Which isn't so much an issue with TRY/CATCH itself, used properly it's very powerful and useful, it just enables some very lazy design practices.

    Far too often it gets turned into a TRY/SQUELCH instead. They use crappy code to swallow errors.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sean Lange - Thursday, September 13, 2018 1:25 PM

    Far too often it gets turned into a TRY/SQUELCH instead. They use crappy code to swallow errors.

    https://imgur.com/a/6CDbTX2

Viewing 15 posts - 62,206 through 62,220 (of 66,000 total)

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