Meet Me In Florida!

While much of North America is bracing for the Snowpocalypse 2011, my thoughts are turning to sunny Florida.

I’m not just thinking of an escape from the cold, dreary weather that February brings with it. No, I’m thinking of the warm hospitality of sunny Orlando and SQLConnections.

I’m going to deliver a couple of sessions at the conference. Check out all of the sessions.

SSC01: Locking and Blocking Made Simple
A good working knowledge of how SQL Server makes use of locking and transaction isolation levels can go a long way toward improving an application’s performance. In this session, we will explore SQL Server’s locking methodology and discover techniques for enhancing query response times.

SSC04: Tips and Tricks for Writing Better Queries
Transact-SQL is not a very difficult language to learn. As long as the syntax is correct, it can be quite forgiving. However, to truly get the best performance from your SQL Server, careful consideration should be given to the structure and logic of the queries. In this session, we’ll discuss some Transact-SQL tips and tricks that can be employed to help you write better queries, allowing your server to perform better.

As I tune into the weather channel and see the nasty arctic weather that’s pelting almost 1/2 of the continental United States, I can hardly wait. I hope to see you there, too.

 

My Most Popular Posts From 2010

I was recently looking through my blogging statistics and discovered that I can see the most viewed posts during that time period. I didn’t know that I could do that. I should spend a bit more time exploring the other features of WordPress.

Like all statistics, they can be a bit skewed. For example, a very popular post published in late December wouldn’t be well represented compared to a post from January. The earlier one would have much more time to be found and indexed in the search engines.

  1. How I Use My iPad for Business
  2. Book Review – Learning SQL Server 2008 Reporting Services
  3. The effects of DISTINCT in a SQL query
  4. Interactive Sorting Using a Tablix in Reporting Services
  5. Making Presentations With My iPad
  6. So I Got Promoted, Now What? Stop Doing Your Old Job
  7. My Experience with a Virtual Assistant using TimeSvr
  8. The Power of Regex in PowerShell
  9. The effects UNION in a SQL query
  10. Viewing Missing Indexes in Management Studio 2005

I’m not sure whether or not I would consider these my “best posts of 2010″. I’ll have to think about that. Maybe I’ll post a link to those another time.

Getting Started With Consulting Webcast Recording Now Available

If you missed my PASS Professional Development Virtual Chapter Webcast “Getting Started With Consulting” last week, it’s now available online.

I haven’t watched it yet just in case Doc in Back to the Future, Part II was right.

I foresee two possibilities. One, coming face to face with herself 30 years older would put her into shock and she’d simply pass out. Or two, the encounter could create a time paradox, the results of which could cause a chain reaction that would unravel the very fabric of the space time continuum, and destroy the entire universe! Granted, that’s a worse case scenario. The destruction might in fact be very localized, limited to merely our own galaxy.

If you watch it, please let me know what you think; feel free to send me any questions or comments you may have.

Keeping Perspective: What Are You Building?

Think about your responsibilities at work for a minute. How many do you have? Can you even name them all?

As technical professionals, we have a myriad of responsibilities This is especially true in today’s economy when so many of us are being asked to do more with less. It’s easy to get caught up in our daily tasks and projects. We must improve the response time of a report and gently slap the hand of the guy who designed it so inefficiently. We must crank out more code to meet an arbitrary deadline promised by a salesman.

It’s easy to lose heart and to think of ourselves as just another cog in the underbelly of a faceless, heartless organization.

At least one-third of each business day is spent at work. For some if us, it’s much more than that. When we are discontented with our jobs, it affects the other areas of our lives. That’s why it’s important to keep a healthy perspective on life.

The Power of Perspective

I’m reminded of the story a man who was waking down the street in old England many years ago when he happened upon a construction site. As he approached, he saw a laborer. The man stopped and asked the laborer what he was doing. The laborer gave a sneering look and replied “I’m laying bricks. What does it look like I’m doing?” and continued about the business of laying bricks.

A few minutes later, the man came to another laborer who was wielding a trowel and slathering mortar onto a granite block. The man asked the second laborer what he was doing. “I’m raising this wall.” replied the laborer as he continued working.

Another few minutes passed and the man came to a third laborer with trowel in hand. The man asked the laborer the same question posed to the first two laborers “What are you doing?” The laborer looked at the man and replied “I’m building a magnificent and grand Cathedral where generations of believers will be able to come to worship God Almighty.”

That’s the difference perspective can make. All three laborers were doing the same thing from an outsiders vantage point, yet each viewed their activities differently.

What Are You Doing?

So, let me ask you: what are you are doing? Are you creating maintenance plans? Or are you ensuring the medical staff have the information they need to help treat patients effectively? Are you going through your daily check list on the servers? Or are you working on something much more important, much bigger than yourself?

How is your perspective?

Removing Time From A Datetime Value

How much time would a DateTime have if a DateTime had no time?

Ok, forgive the bad pun. But the point remains is a valid one. How can we efficiently strip off the time portion of a DateTime value in SQL Server?

I’ve seen a several methods proffered on the Internet. Some are quite clever; others are not so clever. The latter includes converting the DateTime to a VarChar and using string manipulation techniques to loop off the time. That’s not going to perform well.

So what is the best way? Let’s find out.

Three Methods

I’m going to narrow down the field to only three methods for manageability. There may be other methods out there. If you know of one that’s not covered here and you think may be better, please let me know.

To test each case, I’ll employ the conversion 10,000,000 times to see which finishes the quickest. I’ll do this with the following code.

SET NOCOUNT ON
DECLARE @cnt INT = 1;
DECLARE @start DATETIME = GETDATE();
DECLARE @var DATETIME;

WHILE @cnt < 10000000
BEGIN
SET @var = [time removal option]
SET @cnt += 1;
END

SELECT @var;
PRINT CAST(DATEDIFF(millisecond, @start, GETDATE()) AS INT);

Cast To A Float And Back

First let’s look at a technique that casts the DateTime to a float, gets the floor of the resulting value, and then casts it back as a DateTime.

CAST(FLOOR(CAST(getdate() AS FLOAT)) AS DATETIME);

This option finished in a 16,256 milliseconds.

Adding A Date

The next option uses the DATEDIFF function to calculate the number of days since the beginning of time and then uses the DATEADD function to convert it back to a DateTime value.

DATEADD(dd,0, DATEDIFF(dd,0, GETDATE()));

This completed in 15,593 milliseconds, slightly better then the first option.

Converting To A Char And Back

Finally, let’s consider a technique that converts the DateTime to a Char of a specified format and then casts it back to a DateTime.

CAST(CONVERT(CHAR(11), GETDATE(), 113) AS DATETIME

As you may have expected, the conversion to a Char significantly slowed the process down. In fact coming it at 32,698 milliseconds, it took over twice as long as the second method.

Say, Do You Have The Time?

From the three methods I’ve considered, the second method which included using a DATEDIFF to count the number of days since the beginning of time slightly edged out the first method. Both significantly beat converting the DateTime to a Char string.

So, do you have a favorite method? If so, use the test script I’ve posted about and see how it performs. Let me know how it does.

It’s A Major Award!

“It’s a major award!” That’s what Darren McGavin’s signature role, Mr. Parker, proudly proclaimed to friends and family in the 1983 movie A Christmas Story. He was proud of his accomplishment and of the leg lamp that recognized them. What a great movie!

On January 1st, I received a major award as well. Arriving in my email inbox that day was a notification from Microsoft that I was awarded the prestigious Microsoft MVP Award for SQL Server. This was my seventh time to receive this honor and each time I’m humbled and even surprised. This is no “leg lamp” award and I certainly don’t take it lightly.

If you’re not familiar with the Microsoft MVP Program, here’s a short excerpt from the Microsoft MVP web site.

These exceptional community leaders come from a wide range of backgrounds. They are teachers, artists, doctors, engineers, as well as technologists, who actively share their high-quality, real-world technical expertise with the community and with Microsoft.

Thanks Microsoft! And it’s great to be a part of a such a vibrant and active community.

How To Choose A Topic For Speaking

“The human brain starts working the moment you are born and never stops until you stand up to speak in public.” observed Academy Award winning movie producer George Jessel. I think there is some truth to that for many of us.

As a regular speaker at conferences, SQLSaturdays, and other organizations, I’m often asked about public speaking. Some ask about preparation. Others ask about getting started. The most common question is about selecting a topic. That’s one question I can’t answer; I can only share how I do it.

Sharing Your Experiences

Let’s start with the mindset. The way I approach selecting a topic is to first remind myself that I’m not claiming to be an expert in the topic. In fact, I don’t claim to be an expert in anything, really. I don’t pretend to know everything about a subject.

When I speak, my goal is simple – to share my experiences and hopefully help someone else who’s about to go through something similar. Whether it’s troubleshooting a poorly performing server or helping to coach a new technical manager, I want to give them the benefit of my trials and observations. This takes the pressure off of me.

Selecting Potential Topics

As I think about potential topics, I usually consider a few things. First, I look for topics that I’m already pretty familiar with but would like to learn even more. Most every session I give requires me to do research. Preparing to teach something is the best way to really learn it. So, if you’re going to have to do some research, it may as well be in something that interests you, something you’d like to learn more about.

I also look for topics that are underserved in the community. Or put another way, I seek topics that have broad appeal but haven’t been done over and over again by other speakers. These topics aren’t necessarily obvious at first, but if you persist you can usually identify a few.

Finally, I tend to favor entry-level to mid-level topics. Sure, there’s a lot of glory in providing the very high end sessions, but the vast majority of attendees will not be ready for that depth of content. There’s a great need for entry-level to mid-level sessions. This goes back to the prior point: if other speakers tend to gravitate toward the high-end sessions, the mid-level sessions may be underserved in the community.

Creating An Abstract

Once you’ve selected a topic, the next step is to write the abstract.

Creating an abstract is an art. You’ve got to give people a reason to come to your session (or the program committee a reason to select your session for the conference). Stating just the facts about the session in a dry way won’t do that. Make it catchy. Make it compelling.

The title is the first impression they’ll get so you’ll want to put some thought into crafting a good title for your session. Consider titles like:

  • From Zero to Replication in 30 Minutes
  • The Four Pillars of Performance Tuning
  • Manage Your Calendar Or Someone Else Will

The body of the abstract supports and clarifies the title. I usually start with a description of the problem and then talk about the information I’ll convey in the session to help solve the problem.

A Sample Abstract

Consider this real-world abstract that I’ve delivered many times at conferences and Lunch & Learns.

Say Goodbye to Boring Meetings
Ever been in a meeting that drones on and on? It starts late, runs long, and doesn’t really accomplish anything. It’s a complete waste of everyone’s time. Worse yet, since nothing was resolved you’ll have to have a follow up meeting. Argh!

In this session you’ll learn some of the keys to conducting an effective meeting. You’ll gain practical tips for making your meetings more productive and dramatically improving one of the most inefficient parts of your day. You’ll also learn how to help improve meetings your don’t run.

Submitting the Abstract

Once you’ve created the abstract, share it was a few people that you trust to provide candid feedback. Ask them for help with refining your draft to a polished and professional form. Then you can submit it to the local user group, SQLSaturday, Lunch & Learn, or conference.

For More Information

A couple of years ago, I shared my experiences with and techniques for creating presentations in an article I wrote for Simple-Talk.

So what are you waiting for? Get out there and start speaking.

Got any other tips that I’ve missed? I’d love to hear from you with your tips for selecting a topic.

Follow

Get every new post delivered to your Inbox.

Join 34 other followers