Category: Blog

  • Daily Coping 20 Jan 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 eat healthy food that nourishes you today.

    My wife has been on a bit of a diet, actually a few through the last half of 2021. After nearly two years of pandemic life, in which I gained a good COVID fifteen, I decided to join her. It’s a simple set of meal plans that have me eating better, and less, which is the most important part. Mostly it’s a routine of days where I have:

    • small breakfast – either low or medium carb, depending on the day. sample, two eggs and two slice of turkey bacon or oatmeal with blueberries
    • mid morning protein smoothie – usually a little protein powder, some frozen fruit and water/ice. It’s not a great smoothie, but it quells some hunger.
    • smaller lunch – usually a salad or wrap
    • mid-late afternoon protein smoothie – usually a little protein powder, some frozen fruit and water/ice. It’s not a great smoothie, but it quells some hunger.
    • mid-sized dinner – low or medium carb, which has been chicken with vegetables or turkey tacos (limited shells).
    • an apple or similar snack some evenings.

    Today is a low carb day, so eggs and bacon, a couple smoothies, salad with chicken, and chicken with vegetables. It’s not that satisfying, but nearly two years of indulgence has me trying to pay some penance back.

    Also:

    • No alcohol (since Dec 31)
    • No cream in coffee
    • Limited diet soda (I need some indulgence)
    • No dessert
    • No pre-packaged food, other than the oatmeal.

    I feel better, and I’m losing some weight, which is the point of all of this.

  • Creating a new User-Defined Data Type–#SQLNewBlogger

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

    I ran across a question on user-defined data types, which I hadn’t worked with in a long time, so I took a minute to investigate. I wrote this post about an interesting language item.

    User-defined table types let you add a new type that can be used anywhere you would use a base, or normal, data type. This means if I want to have a type of US zip codes, perhaps limiting the base zip to 5 numbers, I can create a type that is limited to 5 digits.

    If I want to create a new user-defined table type, I’d have thought I did something like this:

    CREATE TYPE dbo.USZipCode AS VARCHAR(5)

    However that doesn’t work.

    2022-01-06 10_20_55-SQLQuery1.sql - ARISTOTLE.sandbox (ARISTOTLE_Steve (58))_ - Microsoft SQL Server

    The AS structure is used in many places, but not here. Instead, we use a FROM structure. This means I’d do this:

    CREATE TYPE dbo.USZipCode FROM VARCHAR(5)

    This gives me a type I can use in CREATE TABLE statements, stored procedures, and more. Anywhere I’d use the varchar(5), I could do this instead:

    CREATE TABLE dbo.AddressTable
    ( AddressID INT NOT NULL
    , AddressValue VARCHAR(100)
    , AddressZip USZipCode
    )

    This let’s me use a type that is more intuitive, I guess. I don’t find these that useful in most places. In fact, it’s a little confusing. If I were a new developer, is this a 5 or 9 (or 10) digit field? Is it numeric or string? It’s not easy to determine this. I don’t find these that useful.

    SQL New Blogger

    I was doing other work, but I saved a bit of code and then spent about 10-15 minutes to write up this post. This one shows less about what I learned, and more about what I think.

    Always good to show to a prospective interviewer.

  • Daily Coping 19 Jan 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 connect with someone near you, share a smile or chat.

    One of the things I learned early in life is that being friendly isn’t hard. Waving, smiling, saying “hi”, aren’t things I always see in the city, but in suburban and rural areas, this happens more.

    I also find myself being a little annoyed with myself if I’ve made eye contact and not been the first one to be friendly.

    I had a massage recently, and the masseur wanted to talk, so I engaged and spent time getting to know him. I smiled, looked at him (as best I could), and listened to his thoughts. It was an interesting discussion, and even when I might disagree with something, I resisted an impulse to argue and instead just kept a pleasant chat going.

    Surprisingly, I enjoyed the hour.

  • Daily Coping 18 Jan 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 take a different route and see what you notice.

    This has been an easy one for me through the last two years. I am a creature of habit, but I like exploring a bit when I have time. Without being pressed to get things done, I decided to head to the gym along a different route.

    I skipped my usual turn out of my county and headed down to the next neighborhood. A vet we used to use is on this street, which is how I know it will cut through to a route along the highway. It’s a quiet, pleasant drive, and will take me to the back side of the gym.

    It’s neat to see how the neighborhood has changed and also stayed the same. This is an older house that I remember driving by, with the small windmill. Lots of these still around.

    20220111_123043

    Some new ones as well. Wish there was more open space, but I completely understand someone wanting this view.

    newhouse