Author: way0utwest

  • Creating a New Sequence–#SQLNewBlogger

    I wrote about sequences in an editorial recently and decided to start using them. Creating one turned out to be surprisingly easy.

    I had a table I’d been logging some data in, with a PK, but no natural key or identity bound to the table. Instead, this was low volume (1x per day) and I just manually adjusted the PK value.

    I decided to create a sequence. As I did this, I found it interesting and consulted the BOL page for some ideas on the options.

    The first part is simple. A name and datatype.

    CREATE SEQUENCE dbo.MyKey as INT

    That makes sense. Next, I need a starting value. In my case, I had 7 values in the table, so I added this:

    START WITH 8

    That gets me what I need. The last part I added was the INCREMENT BY clause. In my case, 1 works fine. My code:

    2020-05-09 09_33_59-SQLQuery7.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (56))_ - Microsoft

    The last query is how you get the next value. The NEXT VALUE FOR phrase can be used in various places, but that’s for another day.

    If I needed to bind values, I could use the MINVALUE or MAXVALUE, which I’ll look at in a different post. I could also control caching and cycle values if I needed to.

    SQLNewBlogger

    I actually started a post on binding this to a column and then decided to add this short post in about 5 minutes.

  • An All Star Lineup for EightKB

    An online conference is coming on June 17, 2020 that is full of high level content. It’s the type of event that I think contains information relatively few people will truly understand and use, but most will find interesting. This is EightKB, a SQL Server Internals Conference featuring these speakers:

    • Bob Ward
    • Erin Stellato
    • Joey D’Antoni
    • Pam Lahoud
    • Argenis Fernandez

    That’s quite an all start lineup of speakers. Levels of content range from 400 to Insanity.

    This is put on by Andrew Pruski (T|B), Mark Wilkinson (T|B), and Anthony Nocentino (T|B).

    If you want an entertaining day of content, sign up today and enjoy the ride.

  • Licensing Audit Advice

    I’ve never been through  a licensing audit at work, but I have been worried about them a few times in my career. A few bosses have warned me about them possibly coming. While I’ve tried to ensure that the organizations I worked for were compliant, I’ve always worried about losing track, making a mistake, or mis-interpreting the EULA rules. Those EULA rules and licensing guidelines are not written for most people to understand, and the verbiage is ambiguous at times.

    I saw an article containing advice on going through a licensing audit that caught my eye. This was for an Oracle audit, but I suspect the advice would be similar if this were for SQL Server or any other product. Since an audit is a legal proceeding, it’s worth treating any licensing audit as you would a legal matter.

    I am not a lawyer, and don’t take this to be advice or a recommendation. These are just my thoughts. For me, I would try to go slow with everything. Not to delay, but to be careful and sure of what I was doing. I would concentrate and read all documents carefully, being sure that I know what they mean, asking for clarification if there is any doubt, and ensuring my organization’s legal representative was available for questions.

    I’d especially be careful about only answering questions and not being overly talkative and volunteering information. I’ve seen plenty of people get into trouble because they talk more than necessary. That might be good advice for life in general: listen more; talk less.

    SQL Server, unlike many products, can be tricky because no license key is really checked. I’ve seen scripting and manual processes use the same product key for ever installation. There’s nothing fundamentally wrong with this, but it does mean that someone is still responsible for ensuring that licenses are being tracked against installations and upgrades.

    While I have no desire to deal with licensing, I know that if I act as a DBA in any way, it’s likely part of my job. I would (and have) tried to get someone in an Accounting role to keep track of purchases and usage of licensing, updating them whenever I install or decommission an instance. At least then we have more than one person tracking the data and potentially another person that might be in charge of handling the audit ;).

    Steve Jones

    Listen to the podcast at Libsyn, Stitcher or iTunes.

  • Daily Coping 3 Jun 2020

    I’ve 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.

    Today’s tip is find three good reasons to be hopeful for the future.

    Reason 1 – Most people are recovering

    One of the things that I haven’t seen often shown in various reports on data is how many people have recovered from the Coronoavirus. I know the more conservative people that I see post will point out that most people recover, and that’s true. It’s also true that a lot of people haven’t, and 99% recoverability is still a scary number. I coach kids on tournament days where there are often 100 people between athletes and coaches. If one of them died every tournament, I’d be devastated.

    However, many people are recovering and that’s good news. I have no idea of this means some level of immunity, some herd protection, or anything else, but I am hopeful that this will mean the world will start to progress forward at some point.

    Reason 2 – My family is coping

    Selfish, but as we’ve gone through this, some of us leaning on each other, and getting closer, we’ve also been healthy and managed to find ways to still enjoy life. The hopeful thing for me is that we still have hope.

    Reason 3 – I’ve Learned to Appreciate More of Life

    My life is chaotic, and on the go. I flew over 100,000 miles in the air last year, spent many nights away from home, and enjoyed my adventures, many of them with family. I love the gym, I love coaching, and more.

    These last few months have taken much of that away, with us mostly resigned to being at home and learning to be there all the time. There have been some hard days, and some difficult days for me, but I’ve learned I can cope and find ways to enjoy the changes in life.

    I’m hopeful that no matter how the world looks for the rest of my life, I’ll find ways to enjoy it.