Introduction
This months T-SQL Tuesday is hosted by Jess Pomfret (b|t). The topic is looking for my favorite ‘life hacks’, things that make my day easier. I offer up three hacks. Two are SQL-based and therefore technical. The third is something I hacked for a favorite hobby of mine: baking home made bread.
Hack #1: Multi-Lined Editing in SSMS
I am assuming that 99% of SSMS\Visual studio users know this one, but I did recently show it to my boss and it was a revelation for him. So for the one per cent who don’t know it, you can edit multiple lines simultaneously in SSMS. To do so, position the cursor on either the top line you want to edit, or the bottom line. Then press and hold the SHIFT and ALT keys, and use the up\down arrow to extend the cursor to additional lines. Once there, whatever you type will show up on all of the lines within the extended cursor.
Here is an example. In the image below, I have a partial SQL query. For the IN clause, I need to add a comma between every element. To do so, I place the cursor to the left of the “6” in line 7, press and hold SHIFT and ALT, and use the up arrow until I get to the “2”. I then type the comma and it shows up on all of the lines.
Hack #2: SQL Formatting in a Text Editor
Having marginally formatted code is better than some of the gibberish we sometimes see as DBAs. There are a lot of great commercial utilities out there for DBAs, including a whole class of SQL formatting tools. These are great, but sometimes they get cut out of the budget. I have tried some of the freeware ones that work as a plug in for SSMS, but have generally found them buggy, and increase the tendency for SSMS to crash.
The app I probably use the most in my day-to-day work is NotePad++. If you are not familiar with NotePad++, it is a great text editor (I am actually using it to write this article). It also supports all kinds of plug-ins that support formatting XML or JSON, or (you guessed it) T-SQL. I use a plug-in named “Poor Man’s T-Sql Formatter.”
To see how it works, I have some messy SQL code below. After installing the plug-in, you just click “Plugins>Poor Man’s T-Sql Formatter>Format T-SQL Code” and your SQL is transformed.
Hack #3: A Bread Proof Box from Readily Available Items
I started baking bread at home a few years ago. It has become one of my favorite hobbies. As I learn more, I improve, and as I improve, I want to be more consistent. One of the ways that commercial bakeries provide a consistent product is by controlling temperature and humidity as the bread rises. They do this in something called a proof box. You can purchase a home sized proof box for about $150-$200 (USD). However, for a small box that can control temperature and humidity, I thought I could scrounge together something similar from items I already had. I was able to cobble together one from the following items:
- Small Folding Table
- Towel
- Electric Heating Pad
- Plastic Storage Box
- Remote Grill Thermometer
To set it up, place a heating pad on the folding table, and the towel on top of that.
Next, put a trivet on the heating pad, and my un-risen dough on top of that. Place the probe for the thermometer near or on the dough, but not touching the heating pad. I place to mugs of near boiling water next to the bowl with the dough in it (for humidity).
Then put the storage box over top.
I monitor the temp with the thermometer, leaving the heating pad on until the air in the storage box reaches the desired temperature (it does not have to be remote, but that is what I had). If it gets too warm, I can just pop up the box. Too cool and I can raise the setting on the heating pad.
For this dough the temp started at 66 degrees. It was up to 75 degrees in about four minutes. At that point, I turned off the heating pad. The temp continued to climb to 79, and I wanted a range of 75-80.
Of course the whole point of this is to get tasty homemade bread!
In Conclusion…
I hope that you are able to use some of these hacks in your own endevours. I look forward to reading everyone else’s life hacks.
What is the name of the thermometer you used. I have the same one and am needing a part for it.