Author: way0utwest

  • An Update to Skipping the Leading Digit in T-SQL–#SQLNewBlogger

    There was an interesting question in a forum, which I wrote about before. How do you skip the leading digit in a numeric value. I had looked at a UNION, but someone had a better suggestion, so I’m adding to the post.

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

    Another Predicate

    In the previous post, I used a <> and then a > and < with a UNION. Howver, someone noted that NOT BETWEEN is an option. I could rewrite the query this way:

    SELECT *
     FROM dbo.Room AS r
     WHERE room NOT BETWEEN  200 AND 299
    

    This gives me the same result:

    2022-10-05 14_32_43-SQLQuery6.sql - ARISTOTLE.sandbox (ARISTOTLE_Steve (61))_ - Microsoft SQL Server

    This also results in a seek.

    2022-10-05 14_33_30-SQLQuery6.sql - ARISTOTLE.sandbox (ARISTOTLE_Steve (61))_ - Microsoft SQL Server

    The BETWEEN or NOT BETWEN is sargable, meaning we can use an index to find those values that fall into this ordering and exclude them.

    Worth remembering BETWEEN when writing queries for ranges.

    SQL New Blogger

    An update to my post, showing a better way, showing I am happy to take advice from others, and I can improve code. This is a skill that employers need, especially when teams need to become more consistent with coding when working together. Showing you can adapt and grow is a good skill.

    You could write a simple blog like this that shows how you might change some code you wrote in the past. I bet it takes less than 30 minutes.

  • The Digital World Remaking the Analog One

    I got a taxi at Heathrow in the UK recently to go from one terminal to the other. I know, there are buses and trains, but it was late, I had my wife with a lot of luggage and I was worried the restaurant in the hotel would close before we managed another method of transport. As we were making our way over the driver noted there was a £5 charge to drop off at a terminal. That sounds silly, but I saw a billboard noting this and there is a link that this charge applies to almost all vehicles entering the airport terminal areas.

    You might agree or disagree with the charge, or concern yourself with whether the airport authority or local government can (or should) add this as a little tax to those that drive to terminals. That isn’t my focus today. Instead, I thought this was a somewhat amazing, DevOps experiment of how the digital world is remaking the real, analog one.

    Making this decision in the past would require a lot of infrastructure, some gates, people to man them or automated systems to take payment. In this new world there cameras needed, and software that must be built, but this can also re-use payments systems online and take advantage of computing power to assess this charge. The costs might even be lower as the government might absorb some of the camera cost and maintenance as a part of their security concerns.

    Maybe more importantly, adjusting the charge or eliminating this is a decision and a small software or data change. We can remake the way the world works without much effort at all, similar to how we might remake the digital one when we change code. The world of software is only limited by the imagination of developers. That seems to be bleeding into the physical one.

    I find more and more places where software is changing and affecting the physical world. We saw digital menus replace physical ones during the pandemic. While some places have returned to physical ones, others have used hardware tablets to not only present menus, but take orders and payment. In a recent trip to the UK, many places allow complete self service where a patron enters a table number and someone brings their order without any other interaction. I don’t know I think this is better, but it is changing the way the physical world works.

    It’s not just payments and charges, but there are more and more places where software helps manage traffic flows (people or vehicles) without infrastructure. Just directions that people follow, and perhaps get fined when they don’t. I see live translations of text changing the need for producing signage in multiple languages.

    There are plenty of examples, especially as AI/ML systems can help adjust our interactions in the physical world with less hands-on coding from human developers. Something that becomes more important as we are struggling to find developer talent in the modern world.

    Whether you like this or not, the world is changing. We might not like it, and we might try to convince others to build software we prefer, but we will be interacting with software more in ways that change how we interact with the physical world.

    Steve Jones

    Listen to the podcast at Libsyn, Stitcher, Spotify, or iTunes.

  • Daily Coping 17 Oct 2022

    Today’s coping tip is to make progress on a project or task you have been avoiding

    Most of the things I do for work are spent looking in the future. I’m always trying to prep and prepare things ahead of time because the difficulty of getting work done today for tomorrow is hard. Especially creative work.

    I’m writing this a week early, because, well, I needed to tackle something. I had been invited to be a part of a Learning Pathway at the Data Community Summit 2022. I knew this, but since I didn’t submit and plan for this, it wasn’t something I was that excited about. I enjoy the topic and talking, but I wouldn’t have picked this overview one.

    So I have been procrastinating and delaying working on this, but I realized I needed to get it done. I buckled down and took an afternoon where I worked on the deck, outlining the flow. Then another day to flesh out details and practice a first run through.

    Slow progress, but it got me moving.

    I started to add a daily coping tip to the SQL Server Central 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.

  • Data Points From Life

    I spent a week in Hawaii with my wife, which was wonderful. Relaxing, recharging, and a vacation with almost no plans. We did things somewhat day by day, which we often do, but many days had no plans at all. Sitting on the beach reading, or floating in the ocean were a good way to relax.

    At one point my wife wanted to know about some data in her life. She asked about how many trips we’d taken together this year (8 as of then). She also noted that with this visit to Hawaii, she’s now visited 49 states. That’s more than me.

    It got me thinking about some data in my life. I track a few things, but I decided to run a few queries and note some lifetime things:

    States Visited:46 (though 3 more I haven’t spent a night in the state)

    Countries Visited: 23

    Cars owned: 31

    Blogs posted professionally: 3,524

    Editorials Written: 2,440

    Years running SSC: 21

    Years speaking: 19

    Talks given (since 2008): 404

    Miles flown on United: 830k

    Longest running streak: 1564

    Probably a lot more to track and more I can log. I’m slowly assembling data about my life into a database, mostly for fun. Hopefully I’ll get more organized and use it in a few presentations.