DBTechCon – Spring 2011
You’ve been hearing about this virtual conference for months now. Did you know it’s not just about SQL Server, or databases for that matter? The presenters for this conference are top-notch in their fields covering databases, testing, methodologies, Web Presentation and more. You won’t find a better value for your time or money. Registration to the conference also grants you access to those sessions you were not able to attend. Increase your professional value by registering now.
New Show – Kevin Kline, Denny Cherry
Special Edition: The show today is hosted by Kevin Kline and he interviews and talks with Denny Cherry. Wide ranging interview – tips, experiences…Getting involved with the community, learning SQL, getting involved and so much more.
[Watch the Show] (it’s free)
Scheduled Processing in Windows
Scheduled processing in a Windows environment can be a challenge. Unlike many other mainstream operating systems, the strength of Windows was focused on real-time units of work. A good amount of the work was user-initiated, not work scheduled to be performed at a specified time and reviewed later.
When Microsoft ported Sybase into the Windows environment, they also added the SQL Agent, which is a separate service that enabled scheduled tasks to be performed. For most of you, this isn’t really news…you’ve probably been using it for a long time.
SQL Agent ships with most versions of SQL Server, allowing you to schedule just about any kind of program or command you wish. Its integration with SSIS (SQL Server Integration Services), PowerShell, TSQL, etc. opens up a huge world where you can do almost anything.
Typically, SQL Agent is used to schedule and execute maintenance work on a database during off-peak hours such as backups, database defragmenting, updating of statistics, Database Consistency checks, and other resource intensive tasks.
Sometimes, there is the need to run jobs on a server that doesn’t have SQL Agent installed. In this situation, you may see Windows Schedule Service being used instead.
Both of these scheduling tools have some flexibility and a lot of capability built in when establishing scheduled tasks. As your capabilities and needs increase, the number of defined scheduled tasks may increase as well, which may result in scheduling sprawl. It becomes harder to know what is running, or going to run, when it will run and what conflicts may occur.
As the number of servers increase, the ability to see the interaction of one job to the next becomes harder to track. We’ll be digging into the issue of scheduled job management more. If you have techniques, tools, or insight you’d like to share on managing automated tasks in Windows, be sure to drop me a line.
No Magic Number Feedback
I had a couple responses to share from readers about the recent editorial on “No Magic Numbers.”
Mallard writes:
Ben, consider using case statements, instead of if-then’s …
switch (@X) //this can be an if statement so the cases are true, false -> handy
{
case 1: //comment
...
case n: //comment
...
}
There’s a lot of reasons it’s better, easier to debug, gives a clue on what’s happening, nested they expose things that get lost using a ton of if’s since the branching is clarified; I do this with SQL as well for the same reasons.
Steffen writes:
In situations, like you were talking about, we typically would have a table:
CREATE TABLE [Status] ([Id] int NOT NULL, [Symbol] varchar(100) NOT NULL)
Having values: (1, ‘Status_Active’), (2, ‘ Status_Inactive’), (3, ‘ Status_Deleted’)
The value of [Symbol] is used in UI applications to lookup the localized term in a resource.
In SQL scripts we write:
IF @X = 1 /*Status_Active*/
Doing a global search in source files will give a good hit rate, when we want know where a particular value is being used.
What’s Happening RIght Now
Want to know what’s going on at SSWUG without waiting until the next newsletter? Check out SSWUG.ORG on Twitter at @SSWUGorg or Facebook at www.facebook.com/SSWUG.
If you have feedback, be sure to drop me a note on Facebook, Twitter, or e-mail at btaylor@SSWUG.org.
Cheers,
Ben
Featured Article(s)
T-SQL Features of SQL Server 2005 (Part 2 of 3)
Many new T-SQL features were added with the release of SQL Server 2005. Developers and DBAs may not be taking advantage of them. Learn how to use new features like Common Table Expressions, ranking functions, the output clause, and more.
Featured White Paper(s)
Upgrading to Microsoft SQL Server 2008 R2 from Microsoft SQL Server 2008, SQL Server 2005, and SQL Server 2000
More than ever, organizations rely on data storage and analysis for business operations. Companies need the ability to deploy… (read more)