Author: way0utwest

  • Daily Coping 14 Oct 2021

    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 look for the good in people around you today.

    I’m in the office today, but no idea how many people I’ll see. However, I was with a number of people recently in Colorado. I went to go watch a high school volleyball game, and I ran into a lot of people that I knew.

    I took a few minutes to think about what I appreciated about them, and what they’d done that was good. Not all of them were people I’ve gotten along with, or even liked seeing, but I did find things that they do that help the world.

    Thinking of those things made me smile.

  • Republish: The Digital Twin

    Hopefully I’m in the UK today, and I’m cleared to travel. This is time in the office and some recording for the PASS Data Platform Community Summit, so you get a republish of The Digital Twin.

  • Daily Coping 13 Oct 2021

    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 start with the most important thing on your to-do list.

    I’m in the UK today, so my to do list is what the company needs. However, I am actually writing this before I leave, thinking about fall life in Colorado.

    As winter approaches, we have a lot of things that need to get completed before the ground freezes and weather gets bad. It’s not often really bad, but it is more difficult to work during the short days, in chilly weather, and with other commitments. My current list is, in no order:

    • get the pastures cut (mowed)
    • blow out sprinklers
    • use or drain gas in mowers
    • clean out the shed to get a mower in for the winter
    • recharge/replace the generator battery for the house
    • rebuild the generator shed for the riding arena
    • paint some spots on the house
    • paint the master bathroom
    • do some maintenance on the BMW
    • change the Chevy oil
    • Change oil in the UTV and ATV on the ranch

    There are probably a few other things I’ve forgotten, but these are the main ones. I’ve slowly masked and painted a little some nights, and I’ve been trying to work on the pastures. The recommendation from the state agriculture board is cut early in spring or late in fall. I missed spring, so I started in September mowing. That’s about 40 hours of work.

    However, one thing I need to get done at the top of the list is close the sprinklers for the winter. It’s been warm in CO, so I haven’t been worried, but with a trip overseas, I can’t leave this. I went out and bought a air connector for the new pressure valve this weekend and then blew out the lines.

    One thing to cross off for winter.

  • T-SQL Tuesday #143 – Short Code

    T-SQL-Tuesday-LogoI’m late, but I wanted to get this out. I started the post, then got distracted with travel to Europe late last week.

    In any case, this month the host for T-SQL Tuesday is John McCormack, with his invite to write about short code examples. It’s a good technical invite, and one that immediately got me thinking about things I do often.

    If you haven’t ever tried a T-SQL Tuesday, set up a blog and put out a post on the topic, this week or whenever you read this.

    Snippets

    I work for Redgate Software, though I’d likely be using SQL Prompt no matter what. I was never thrilled with native intellisense, but SQL Prompt has been great. One of the things I like most about Prompt are the snippets, which let me insert code with a few keystrokes.

    Here’s a quick example. If I type “” in SSMS, I see this:

    2021-10-13 10_52_32-CandidateList

    Prompt detects this as a snippet first, then has other matches. I can hit Tab, and I’ll get this:

    2021-10-13 10_52_46-CandidateList

    I get a quick “top 10” from a table. Often I use SELET * for a quick look at the shape of data.

    However, I can add custom snippets, and one I use often is this:

    WITH myTally(n)
    AS
    (SELECT n = ROW_NUMBER() OVER (ORDER BY (SELECT null))
      FROM (VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10)) a(n)
       CROSS JOIN (VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10)) b(n)
    )
    SELECT *
    FROM myTally

    This is my “tt” snippet, so I can type “tt<Tab> and get this code for a tally table. This s handy in many string manipulation and problem solving situations.

    If I need more than 100 rows, I can easily copy the cross join line, add a new alias, and I have 1000 rows with this:

    WITH myTally(n)
    AS
    (SELECT n = ROW_NUMBER() OVER (ORDER BY (SELECT null))
      FROM (VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10)) a(n)
       CROSS JOIN (VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10)) b(n)
       CROSS JOIN (VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10)) c(n)
    )
    SELECT *
    FROM myTally

    Short, but effective code.