Category: Blog

  • Daily Coping 20 Aug 2020

    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.

    Today’s tip is to be thankful for your food and the people who made it possible.

    At home, it’s usually me that cooks. I enjoy it, and I appreciate it when someone else does cook. It was a real treat a month or so ago when my son came down, bought supplies, and made sushi for me while I got to sit at the counter and relax.

    20200611_193929_HDR

    As someone that’s worked in lots of restaurants, I appreciate the work people put into cooking and serving food. During the pandemic, I’ve rarely gotten prepared food, but I have gotten a few meals. In particular, one of my local groceries has fresh sushi they make. I make it a point to complement the chefs there and thank them for making it.

    I also try to stop and think about how hard it must be for certain people to work in the restaurant business, owners, cooks, servers, etc., all struggling I’ve tipped more, and as I write this, my wife and daughter are heading to town to a local Poke bowl place. We used to get bowls and sushi there, but the owner had to shrink is menu to just ramen and poke. My wife tries to go once a week to support him and say hi.

    Always remember your circumstances, no matter how hard or easy, are not what others experience. Keep empathy in mind.

  • A Quick SQL Change Automation Build

    I was going through a few of the Redgate products with a customer recently and they wanted to perform some validation of the build and release process with SQL Change Automation without setting up Azure DevOps or Jenkins or any server. Not a  bad idea, and a good way to actually learn how to do things.

    Working with PoSh is a little funny, since many of the Redgate cmdlets require objects, not strings, so this is a quick post on how to get a build working and output a nuget package with your database code.

    Prerequisites

    The things you need to do before we get started:

    • Have a SQL Server instance you are a sysadmin of (or at lease create/own dbs)
    • Install SQL Change Automation
    • Set up a SQL Change Automation Project
    • Create a folder for storing build artifacts

    The Script

    I’m going to show the script first, and then I’ll describe how a few things work, since I expect some people want to just get a build working.

    # Build script for SCA projects
    param( $OverrideVersion="3.2")
    # Instance variables
    #    BuildInstance - SQL Server instance name for building 
    $BuildInstance = "Aristotle"
    
    # Database Variables
    #    BuildDB - existing database used for build connection. Won't be altered
    $BuildDB = "builddb"
    
    # Package Variables
    #    PackageID - Set the nuget package name to be used
    #    PackageVersion - suffix on nuget package id.
    $PackageID = "SimpleTalkDB"
    $PackageVersion = $OverrideVersion
    
    # Path variables
    #   ProjectFile - full local path to the SCA project file (.sqlproj)
    #   BuildArtifactPath - Path where the Nuget package is stored
    $ProjectFile = "E:\Documents\git\SimpleTalkDemo\SimpleTalkDB\SimpleTalkDB.sqlproj"
    $BuildArtifactPath = "E:\buildartifacts"
    
    # Debug
    # Use Continue to get more output
    $DebugPreference = "SilentlyContinue"
    
    # Setup database connections using variables from above to the build instance
    $BuildConnection = New-DatabaseConnection -ServerInstance $BuildInstance -Database $BuildDB
    
    # Build the database with a validate
    $ValidProject = Invoke-DatabaseBuild $ProjectFile -TemporaryDatabaseServer $BuildConnection 
    
    # Get the artifact and write to disk. Note the name comes from the package vars above.
    $buildArtifact = New-DatabaseBuildArtifact $ValidProject -packageId $PackageID -PackageVersion $Version
    
    Export-DatabaseBuildArtifact $buildArtifact -Path $BuildArtifactPath

    This is a basic script that validates a SQL Change Automation project and packages up a particular version of your project.

    The way this works is as follows. First variables. For the build I need to change these:

    • BuildInstance – where will I run the build
    • BuildDB – I just need an existing database for the build. We actually won’t use this.
    • PackageID – Name for the nuget package
    • PackageVersion – What version. This can be passed into the script as a parameter
    • ProjectPath – Where is the sqlproj file from SQL Change Automation
    • BuildArtifactPath – Where am I storing the artifacts.

    The flow of the script is:

    • Set variables
    • Create a connection to a SQL Server (New-DatabaseConnection)
    • Build, which is to perform a project validation on a SQL Server (Invoke-DatabaseBuild)
    • Create the artifact in memory (New-DatabaseBuildArtifact)
    • Write the nuget package to disk (Export-DatabaseBuildArtifact)

    From here, I’d use the Nuget package as the start of a release process, another post for another day.

    I can override the package version with a parameter, so I can enter this on the cmd line:

    .\builddb.ps1 3.3

    That gives me a build that works on my system.Successful build from PoSh

    In my folder for BuildArtifacts, I see the new package.

    List of nuget packages in folder

    Give it a try, and let me know if this works for you.

  • Daily Coping 19 Aug 2020

    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.

    Today’s tip is to contact a friend to let them know you’re thinking of them.

    When the pandemic hit, and we locked down travel and most interactions, I felt isolated. I started these tips back in March. I can’t believe I’m still doing these after 4 months. I also cam surprised how much they help me.

    One of the ideas I had early on in March was to reach out to friends that I expected to see, but was suddenly separated from. I had it a point to reach out to 2-3 people every couple days and check on them. I picked up my phone, or Facebook, or email, and randomly hit a letter. I then picked a person and sent a “I’m fine, how are you doing” message. I was surprised how often this led to a 3-4 message exchange, taking up a few minutes of our day, before we both moved on.

    I still do that, albeit a bit less, but I’m randomly checking on people, especially a few people that I know have had some difficulties and are struggling. I’d encourage you to do the same.

  • Daily Coping 18 Aug 2020

    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.

    Today’s tip is to smile and be friendly, even when physical distancing.

    I’m not out too much, and often when I am in a public business, I am wearing a mask. While I’ve looked at a mirror when I smile with a mask, it can be hard to tell if that’s what I’m doing.

    However, I am at various outdoor places, without a mask. Whenever I am, I try hard to smile at more people. Wave, be cheerful, let them know there is still happiness in the world.