Author: way0utwest

  • No Scalars with JSON_QUERY–#SQLNewBlogger

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

    I started to dig into JSON queries recently, and as I continued to experiment with JSON, this struck me as strange. Why is there a NULL in the result?

    2020-12-04 14_43_02-SQLQuery3.sql - ARISTOTLE_SQL2017.Compare2 (ARISTOTLE_Steve (58))_ - Microsoft S

    The path looks right. This appears to be somewhere I ought to get a result back. As I looked up the JSON_QUERY documentation, and it says I get an object or array back. I’d somewhat expect that position, while containing a single value, could be seen as an object of

    {“setter”}

    The fact that I need to know I have a single value here seems like poor design. If the document changes, perhaps someone might enter this:

    DECLARE @json NVARCHAR(1000)
         = N'
      {  "player": {
                  "name" : "Sarah",
                  "position" : "setter, DS"
                 },
        "team":"varsity"
      }
    ';

    In this case, a JSON_VALUE would fail, while a JSON_QUERY wouldn’t work in the first example above. This means that I need to modify my code based on documents.

    I don’t like this, but I need to know this, so if you work with JSON, make sure you know how the functions work.

    SQLNewBlogger

    While writing the previous post, I changed one of the function calls and got the NULL. I had to fix things for the other post, but I kept the query and then spent about 10 minutes writing this one to show a little thought into the language.

    You can easily take something you are confused about, made a mistake doing, or wonder about and write your own post.

  • Your User Group Goals

    Many of you reading this piece have likely been to a user group at some point in your career. Some may go every month, some may go a once or twice annually , and some may not have been for years. I also know some of you don’t have a group in your area, or perhaps not enough people for a SQL Server group, but I would bet if you are working in technology, there are enough people to have some sort of technology group, perhaps even an online book club.

    Recently I was speaking with Andy Warren about his group in Orlando. He’s preparing to turn over leadership of the group to others, and he’s actually looking for comments on the docs he’s put together. I’d urge you to take a moment and think about your group and how you want it structured and check out what Andy has done. He’d appreciate comments on his effort, whether you are in leadership or just show up at meetings.

    Our discussion, however, was on goals. What goals are appropriate for the group, and what guidelines should he leave for others. He’s tended towards goals of “more”, meaning more people touched, more attendance at meetings, more events. I’ve tended to aim for more ensuring you keep people interesting, inspired, and with some engagement, but not worried about size.

    Whether you are in the leadership of a group, just an attendees, or wish you had a more interesting group of technical people to meet with regularly, what do you wish your group would accomplish next year? Are there things that matter to you for an organization outside of work that might help your career? Take a minute to think and leave me a comment today.

    Steve Jones

    Listen to the podcast at Libsyn, Stitcher or iTunes.

  • Daily Coping 16 Dec 2020

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag. 

    Today’s tip is to listen wholeheartedly to others without judging them.

    I was talking with a friend recently and they were struggling with their workload. They complained about the amount of work, and the dates things were due, while also noting they were struggling to focus and get things done.

    In the past, I’d have suggested something, or maybe questioned how they were planning on doing the work. I might even try to get them to see where they weren’t taking advantage of the time they did have and resources available.

    In other words, I would have been my typical Type-A, let me solve your problems person.

    Instead, I did none of that. I sympathized, empathized, and wished them luck, while asking if I could help.

    Sometimes I think venting and talking aloud helps someone sort through their thoughts, and my wife has helped me to learn how to be a sounding board without offering my own input.

  • Never let a good crisis go to waste

    There have been quite a few jobs in my life where my first day was complete chaos. Some were technical and some were not. I had a first day as a bartender (in more than one job) where someone was sick or the place was busy and I was left on my own to figure things out. Fortunately, I know my way around a keg and a bottle of liquor. I’ve also started at a couple tech jobs where we had a crisis in a system. I’ve been able to pitch in and help solve problems, or even get other work done on my own. In all these cases, the boss was impressed, and I often started out my tenure with quite a bit of credibility.

    When we look to make changes, it can be hard to convince someone that the change is better for the organization. This might especially be true when working in software development and trying to convince someone to change their process or habit. I see this all the time as clients look to adopt DevOps, with no shortage of naysayers. There are always plenty of people that want to maintain the status quo.

    I heard quote from a presentation by Comcast execs on DevOps: “never let a good crisis go to waste.” The quote has been attributed to others in history, but I think it’s an apt description of how to drive your processes forward when you know there are problems and issues and no one wants to spend time fixing them. Pain often allows an opening for a better solution to be considered.

    Too often when there is no problem, no immediate pain, there is a lack of will from management to spend time improving things. Certainly there are some executives that believe in improvements, but far too many focus on adding something new rather than improving the underlying infrastructure of software development. When you see a problem, if you can’t make an improvement at the moment, keep an improvement or solution handy. You never know what a crisis might give you the opportunity to pitch a better way forward.

    Steve Jones

    Listen to the podcast at Libsyn, Stitcher or iTunes.