Are the posted questions getting worse?

  • Dennis Jensen wrote:

    First I am still learning this forum so do not know how to properly quote messages but to answer Jeff Moden 2nd statement then 1st.

    I concur with your Steps 1, 2, and 3 as every student is unique each with their own best method of learning. It is the same with communication (which is what teach is about), if the listener did not perceive what the speaker was saying for whatever reason the fault lies with the speaker because communication by definition is about communicating and their is no guarantee that the receiver is going to listen -- so although the popular concept is that communication is a two-way street is a lie and folks good at communicating have known this back in the BCs and yet we today still want to blame the listener for poor communication skills.  All I have to say is okay using your logic explain to me how the reponsibility resides in part with the listener if someone is communicating to a hostile audience?  *drop the mic and hand the person a paper with the link to How to Win Friends and Influence People by Dale Carnegie a free online PDF*

    Two answer your second question -- I teach my students all aspects of quality coding based on what they are asking about -- my online class/lab is free -- as such it is not a structured class and I do not think anyone has asked yet about quality Unit Tests something I have my team of developers starting to do as they were not doing it before. I also encourage students to help other students because sometimes the best way to learn is to try to teach someone else. However, I monitor everything to make sure the help is valid help and the one helping does not themselves need help. Still I am the one who answers most of the questions. However due to some of the topics that have come up in the classroom I do have to, on occasions, defer to one of my students as that is actually their area of expertise.

    Welcome to the party. Thanks for posting.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Loved watching Red-Green on PBS here in the states.

    -------------------------------------------------------------
    we travel not to escape life but for life not to escape us
    Don't fear failure, fear regret.

  • Eirikur Eiriksson wrote:

    Michael L John wrote:

    Today is Steve’s birthday.  He’s turning 25.

    Is that the 3rd time 😉 😎

    Ouch, I'm old, but not Eirikur-old.

  • This is literally just a "has anyone else had this thought?" question but I was wondering about "catch-all"/"kitchen-sink" queries at the weekend, and new features of Query Store with the ability to store multiple plans.

    I understand that multiple plan cache won't work with syntax like WHERE (SomeID = @SomeID OR @SomeID IS NULL) due to that it only works on equality comparisons, and that isn't a "proper" equality, however, a cached plan could be bad, so it's often better™ to put a OPTION (RECOMPILE) in the query. That, however, completely negates caching.

    With the ability to store multiple plans, could it now be better™ to switch back to using dynamic SQLto build an appropriate and execute it via sys.sp_executesql? I need to do some testing, but wondering if I'm also going down a rabbit hole of pointlessness.

    Simplified examples of queries I'm talking about, if reference is helpful:

    --OPTION (RECOMPILE) method
    DECLARE @SaleDate date = '20220403',
    @BranchName varchar(20) = 'London',
    @SaleType varchar(10) = 'Refund';

    DECLARE @BranchID int = (SELECT BranchID FROM dbo.Branch WHERE BranchName = @BranchName)

    SELECT *
    FROM dbo.Sale
    WHERE (@BranchID = BranchID OR @BranchID IS NULL)
    AND ((SaleDate >= @SaleDate AND SaleDate < DATEADD(DAY, 1, @SaleDate)) OR @SaleDate IS NULL)
    AND (SaleType = @SaleType OR @SaleType IS NULL)
    OPTION (RECOMPILE);
    GO

    --Dynamic SQL Method
    DECLARE @SaleDate date = NULL,
    @BranchName varchar(20) = NULL,
    @SaleType varchar(10) = 'Refund';

    DECLARE @BranchID int = (SELECT BranchID FROM dbo.Branch WHERE BranchName = @BranchName);

    DECLARE @SQL nvarchar(MAX),
    @CRLF nchar(2) = NCHAR(13) + NCHAR(10);

    SET @SQL = N'SELECT *' + @CRLF +
    N'FROM dbo.Sale' + @CRLF +
    ISNULL(NULLIF(N'WHERE ' +
    STUFF(CASE WHEN @BranchID IS NOT NULL THEN @CRLF + N' AND BranchID = @BranchID' ELSE '' END +
    CASE WHEN @SaleDate IS NOT NULL THEN @CRLF + N' AND SaleDate >= @SaleDate AND SaleDate < DATEADD(DAY, 1, @SaleDate)' ELSE '' END +
    CASE WHEN @SaleType IS NOT NULL THEN @CRLF + N' AND SaleType = @SaleType' ELSE '' END,1,8,N''),N'WHERE '),N'') + N';';
    PRINT @SQL;
    EXEC sys.sp_executesql @SQL, N'@SaleDate date, @BranchID int, @SaleType varchar(10)', @SaleDate, @BranchID, @SaleType;

    • This reply was modified 1 year ago by  Thom A.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Lynn Pettis wrote:

    Ring knocker here. I have 25+ years of SQL Server experience, you should listen to what I have to say. 😉

    One a personal note, continuous learner here as there is always something new to learn about SQL Server and Jeff is my goto mentor.

    Same on the continuous learner.

    Exp wise:

    • Oracle - since v 7.4 - 1994
    • Informix - since v 5.1 - 1994 but haven't used it in a few years
    • Sql Server - since v 6 - 1995
    • DB2 - since v 5 - 1997

    I have to say that if we did mix the good things of all of them we would have an really really outstanding product.

  • frederico_fonseca wrote:

    I have to say that if we did mix the good things of all of them we would have an really really outstanding product.

    So... what are you waiting for?

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • WayneS wrote:

    frederico_fonseca wrote:

    I have to say that if we did mix the good things of all of them we would have an really really outstanding product.

    So... what are you waiting for?

    IBM attempted to do that when acquiring Informix, but ended in a bit of a muddy puddle 😉

    😎

  • Eirikur Eiriksson wrote:

    WayneS wrote:

    frederico_fonseca wrote:

    I have to say that if we did mix the good things of all of them we would have an really really outstanding product.

    So... what are you waiting for?

    IBM attempted to do that when acquiring Informix, but ended in a bit of a muddy puddle 😉 😎

    Heh... I keep thinking similar thoughts when it comes to the likes of ChatGPT.  I also keep thinking of the proverb that "In the land of the blind, the one eyed man (even with bad vision) is king".

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

  • I've been having debates with various tech people about ChatGPT. In many cases, it's not worse than the average (or below avg) dev. Not sure what to think of that.

    I think it can save time searching and help you as a tool, but you need domain knowledge to know when the advice or results aren't appropriate or a good solution. I want to experiment a bit more with it, because it can be a good tool. What I'd love is if it were a tool that learned more how to help me rather than a general tool that helps everyone because the way I might solve problems for RG can be different than what IBM might do.

  • Steve Jones - SSC Editor wrote:

    I've been having debates with various tech people about ChatGPT. In many cases, it's not worse than the average (or below avg) dev. Not sure what to think of that.

    That's a bit like asking which would you rather get hit in the head with?  A rock or a brick that's been made to look like a rock? 😀

     

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

  • Here in New Jersey USA it's too nice of a day to sit behind a screen!  Spring fever in full effect here 🙂  After my 2 o'clock meeting... adios

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Steve Collins wrote:

    Here in New Jersey USA it's too nice of a day to sit behind a screen!  Spring fever in full effect here 🙂  After my 2 o'clock meeting... adios

    Heh... a little "Veni, Vidi, ... ah, screw it" is good for the soul. 😀

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

  • This was removed by the editor as SPAM

  • Personally I just enoy playing or plarking either is fine by me and there is nothing more fun to play with than code that is solving a problem.

    At first I did not know what ChatGPT was then I looked into. I concur its a tool at best bascially just another IDE and I do not use those either. Personally I find those tools to be lacking, and often wrong. I have asked younger coders why they used a piece of code and they said I don't know it was what the IDE suggested. Sadly what it suggested was bad code. But was worse the programmer to it to be gospel and to me this is the worst thing that comes about from these kinds of tools. Lazy minded programmers or lemmings that do not understand their own code. Now do not get me wrong, there were plenty of lazy minded coders before IDEs/AIs but now they are getting more prolific. I mean its like wearing a knee brace when you do not need to, if you wear it long enough you will actually cripple your knee and thereafter actually need to wear it. This is also true for IDEs/AIs, you use them when you do not need to then you end up crippling your ability to think about what you are coding. And we all know - A mind is a terrible thing to waste.  I advise most of my students to learn to create quality code without an IDE/AI before every using one and then you won't need it nor be crippled by it. I also STRONGLY suggest that they understand the code they are working, always ask why. I cannot tell you how many bugs I have found in code because everyone assumed that a module or function worked just fine while I did not. I wanted to know what that code was doing and why before I would accept it as being solid quality code.  Further if you are using something in your code because someone else did but you do not know why you are using it beyond that, then you cannot actually know what to expect your code to do and this brings into play secret gotchas because yeah that bit of code is good until you combine it with this other bit of code then it is not good code anymore.

    Personally what I think would be extremely helpful for the industry would be a tool that examines your code and robustly debugs it for you, going into detail of why it considers it a bug or weak code. This way it can help teach how to write better code, thus actually improving one's ability to think. Now I know there are some tools that sort-of do this but nothing that in my opinion does justice to it. This is mainly because their are so many different parameters involved that no one has been able to solidify a complete solution. Now once they master this tool, then those IDEs/AIs will actually be a lot more useful as at least they are a lot less likely to suggest bad code and of course I am sure the ultimate solution is extremely high quality code that can replicate itself for every scenario that is presented to it and the computers then take over the world.

  • I love the knee-brace analogy.

    I don't like the idea of an automatic code debugger.  It would be misused in the same fashion.  A lot of people are just too lazy or ignorant (ok... I really mean stupid and self-centered 😀 ) to do any learning on their own.  It's amazing that we're in an industry were the employee insists that it's only on the company's dime'n'time that they'll take the time to learn.

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

Viewing 15 posts - 66,271 through 66,285 (of 66,547 total)

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