I don’t hate generating SQL dynamically like some may (apparently this is a relatively polarizing topic?) but I don’t love having to do it via SQL itself. Thankfully if I am needing to generate queries dynamically it’s some sort of one-off and not something that I need long term so my go-to for generating SQL is PowerShell. Please enjoy this short play in three acts about my recent need to generate a stupid amount of dynamic SQL.
My first technical job was right out of college in the before before times of 1999: I was the stage manager for a local professional theater. I spent 10 months coordinating communication between the production team, running rehearsals and shows herding actors and the like. All for the fantastic rate of $250/week. At the end of the year I realized even at minimum wage (and the overtime) I would have made more money if I had worked at the McDonald’s down the block.
This post is part of T-SQL Tuesday visit the link to see more posts by other authors! Running a local group is a significant commitment in time, energy and sometimes money. For T-SQL Tuesday I wanted to talk about all the ways I’ve managed to eliminate costs where I could. (For the purposes of this post we’ll start with the assumption that things have returned to normal and in-person meetups are safe and reasonable.
Redgate’s tool SQL Multi Script is super handy: you can execute a script (or scripts) against any number of SQL Servers in your estate. The catch is Multi Script needs to be aware of them. If you have a large estate this can get cumbersome fast as you have to individually add each server. There is hope though: If you have a colleague that has already done so they can export their list(s) and you can then import them.
Yep it’s kind of as gross as it sounds. But there’s a good chance that you have implemented a very nice CI\CD pipeline for part of a vendor database that you are allowed to customize. Unfortunately you don’t always know when they might log in to do a hotfix or patch and you may have dependencies on objects that you don’t own. Automation to the rescue: Previously on this site I outlined how you could audit your SQL instance using free/open source tools.
Back in August I talked about how our organization was using Jekyll to publish our internal docs. This fall I took it a step further and worked out how to publish content generated by Redgate’s SQL Doc. SQL Doc is handy tool that will allows you to easily add meta-data to your database. It’s great: you essentially comment every table, column, view, schema etc. and then commit those changes to the code repository itself.