Chapter 11. Automation Through SQLCMD and PowerShell

In Chapter 10, you learned about the most common maintenance tasks that you'll be called upon to perform as a database administrator. Many of those tasks are routine and also tedious. They are great candidates for automation, and one way to automate is through scripting.

You have two scripting environments at your disposal. One is SQLCMD, a command-line utility that has been around since the introduction of SQL Server 2005. The other is PowerShell, a newer and more expressive scripting environment that addresses the needs of DBAs, system administrators, and even power users.

Scripting in SQLCMD

SQLCMD is a Win32 command prompt utility that allows the interactive execution of Transact-SQL statements ...

Get Beginning SQL Server 2008 Administration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.