SQL Homework – September 2022 – Query window challengeLeave a comment
September 1, 2022 by Kenneth Fisher
I had every intention of doing Replication Part 2 this month but had a thought I liked better. I will get back to replication but let’s do something else this month.
I’m a firm believer that the GUI’s Microsoft has made for us are amazing. Azure Data Tools and SQL Server Management Studio are both awesome tools. That said, this month I have a challenge for you.
Pretend like you are going to have to use sqlcmd, or the DAC (dedicated admin connection). You have no choice, you have to script rather than using a GUI to do the work for you. That means that if you need to take a backup you write a script. Want to see the list of databases? sys.databases. etc. Virtually anything can be done via scripting, and frequently you can do more, faster by scripting things out. Obviously don’t let this stop you from getting your job done. There are a few things that you are better off using the GUI. (Unless you decide to use PowerShell?) But can you force yourself to script? Spend a few extra minutes looking up that command you need?
I promise you it’s worth it. After some practice I can start a backup or restore many, many, many times faster with a script than I can with the GUI. (I mean assuming I’m not going to be restoring a couple hundred log files. Although to be fair, I can do that pretty quickly too.)
So. Challenge given! Do you accept?
Category: Microsoft SQL Server, SQL Homework, SQLServerPedia Syndication, T-SQL | Tags: Microsoft SQL Server, Scripting, SQL Homework, T-SQL