Tag: syndicated

  • T-SQL Tuesday #149–Advice about T-SQL to a Younger Me

    It’s that time of the month again, when we have the T-SQL Tuesday blog party. This month we have a new host, Camilia Henrique with an invitation on advice you would give to your younger self, but in the area of T-SQL. That’s a good one, and it focuses on a technical skill that many data professionals need.

    Participating in T-SQL Tuesday is a good way to practice your writing, your skills, and show your thoughts on some aspect of your job. Even if you miss the party one month, feel free to write a post later and link it to the main post on the T-SQL Tuesday site.

    Practice, Practice, Practice

    I learned SQL first as someone working with dBase, FoxPro, and Clipper. I moved to SQL Server and T-SQL later, with a basic grounding on how to query for simple sets of data, but I quickly learned performance can matter a lot.

    As I’ve tried to keep up with the language, one of the things that has struck me is that T-SQL can be complex to structure because it’s relatively simple with few keywords. You can unintentionally create cross joins or row-by-row (RBAR) structures that perform poorly and waste resources on your system.

    I’ve found that practicing with programming exercises and solving problems to be the best way to improve my skills. I don’t do it enough these days, and when I answer questions on SQLServerCentral, invariably one of the experts there will post a solution that performs better and I learn something new.

    If I were talking to myself, I’d say to look more deeply into APPLY and the OVER() clause right now. Make sure you understand tally tables and their uses, and work through exercises like the Advent of Code, Exorcism, Project Euler, or something similar. Heck, just answer questions in a forum for yourself, with your own solution.

    Learn how to create queries that can efficiently gather together, filter, and aggregate your data in ways that are helpful for clients without taxing server hardware. In the era of cloud computing and pay for data moved or data processed somehow, this is an invaluable skill.

  • Daily Coping 12 Apr 2022

    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 spend as much time as possible outdoors today.

    The weather is getting better in Denver. I’m still expecting snow sometime this spring, but last week we had a number of days that were sunny and 50x, 60s, and 70s. Need some moisture, but while we don’t have it, I’m trying to take advantage of things and enjoy a little more outside time.

    I write these ahead of time, so this is for Saturday, 9 Apr.

    I had an interview with DotNetDave in the morning, so I caught up on some work before that. I went outside around 12, planning to get a few things done around the house. First was replacing generator battery cables. Slightly unnerving, but something that needed to be done.

    20220409_125622

    Next I worked on some landscaping around the generator, which I’ve been meaning to clean up before everything starts growing like crazy. Hard work, but good to be outside.

    20220409_133342

    Finally, I spent a little time cleaning up the area around the water hydrant in the field. We had it replaced a little over a week ago. I had helped dig part of it up and then filled the hole when I was done, but before I could tamp down the dirt more, we went out of town. Today was cleaning up that area and removing panels.

    20220409_144605

    I also had a helper (not really)

    20220409_144210

    Around this I slipped into town and lifted weights, but I took a walk around the area near the gym to warm up instead of riding the bike to enjoy the outside world.

  • Setting the Container Name–#SQLNewBlogger

    I had started a Stairway series on containers (which I need to get back to), and I got a question. How do we set the name of a container?

    If I just start a new container with a generic, minimal command, I get a random name. As an example, I’d run something like this:

    docker run -p 51433:1433 -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Demo12#4" -v C:\Docker\SQL:/sql -d mcr.microsoft.com/mssql/server:2019-latest

    Now if I look at the list of containers, what I see is this container running under the name, “”. Not a huge problem, but when you have a lot of containers, this isn’t ideal. If you look below, this container is the first one in my list:

    2022-03-30 08_54_13-cmd

    However, the first name is listed as crazy_mirzakhani, not something I chose. I broke the image because it’s so wide.

    2022-03-30 08_54_29-cmd

    Let me now start a new container, same image, but with a name. I do this by adding the –name parameter with a value.

    docker run --name dockernamedemo -p 52433:1433 -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Demo12#4" -v C:\Docker\SQL:/sql -d mcr.microsoft.com/mssql/server:2019-latest

    Now if I look at the container list, I see this:

    2022-03-30 08_58_47-cmd

    And the names:

    2022-03-30 08_58_51-cmd

    This is useful to help me keep track of the containers I’ve got running.

    This doesn’t address naming standards, which I might look at as something else that can be complex. I tend to use SQLxxxx where xxxx is the version. If I need multiple ones, I tend to use SQL2019, SQL2019_2, SQL2019_3, etc. Not the best way to do things, but since I match up ports, this is easy for connections. SQL2019 is 51433. SQL2019_2 is 52433, etc.

    SQL New Blogger

    When I saw the question, it was a couple minutes to find a reference and give an answer. I decided to take 10 more minutes and just write this post, publishing a short reference on how to name a container.

    I added a short bit at the end on naming standards, which might be a good thing for you to write on as well.

  • Daily Coping 11 Apr 2022

    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 commit to being more active this week.

    I tend to exercise regularly, though I’ve become less concerned if I miss a day or two than I was in the past. I’m a big fan of small steps, and rather than make this a month goal, let’s try making it a week goal.

    I’m writing this in advance, so I’m noting this particular tip the week before and I’m starting on Tuesday, 5 Apr, to get through the week. Here’s my commitment, and I’ll try to update this once the post publishes:

    Updates with my effort over the week.

    • 5 Apr – yoga, class scheduled for this evening – DONE
    • 6 Apr – weight lifting – I have morning meetings, but then I’ll go to the gym. – DONE
    • 7 Apr – possibly skiing, trying to decide if I can get away. If not, I’ll likely try to swim – DONE – Cardio class with my wife
    • 8 Apr – Yoga, scheduled – DONE
    • 9 Apr – Saturday, and I’ll aim to bike and lift, legs today – Done–  yardwork and legs at the gym
    • 10 Apr – Coaching all day, which makes things tough. I am hoping to find 20 minutes either early in the am or late in the day for a light yoga session on YouTube. – FAIL – nothing. coached from 7am-430p, drove home, had dinner, lay down
    • 11 Apr – Back to yoga class, hopefully a hard one – Done – scheduled for this afternoon

    This isn’t far from a normal week, but if I can get something in on the 10th, I’ll make my goal.