© Bradley Beard 2016

Bradley Beard, Practical Maintenance Plans in SQL Server, 10.1007/978-1-4842-1895-2_11

11. Executing T-SQL Statements

Bradley Beard

(1)Palm Bay, Florida, USA

The Execute T-SQL Statement Task is one of the easiest tasks to set up. All you have to do is have an SQL query that you want to run, paste it in the box—and you’re done.

But wait… what if the query is in an .sql file? And what if that file may change? Does that mean that you have to update this task every time the query changes?

Nope. This is a great example of how SQL Server swoops in to save the day. You can select from direct input, file connection, or variable inputs for the SQL query.

We’re going to set up this task differently than the previous plans, because this task ...

Get Practical Maintenance Plans in SQL Server: Automation for the DBA 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.