Even master trouble shooters can fall prey to the basics every now and then.  Today, I just learned one of the great lessons in debugging all over again.  Fixing bugs is VERY, VERY, VERY simple.  It’s FINDING the damn things that is the hard part.  That’s not the lesson I learned, though.  The lesson learned follows…
Case in point.  Friday, I was running an expression based upon a date and a parameter in my program.  For some weird reason, the expression was returning no values.  I took the expression, parameter and all, and tried running it in SQL Server.  Boom, it worked.  I tried a bunch of different code changes, but NOTHING fixed the problem.  The program still gave back the empty results.  Next step, break out the smallest bit of code into a test program, then make single changes to go from non-working to working.  I did EVERY step I could think of.  No go.  I made as many changes as I could think of, and still no result.  I finally broke out the failing part of the expression.  Still no luck.  Finally, I went REALLY back to the basics… I started checking my assumptions.  Lo and behold, the value I *thought* I was using when running in SQL Server turned out to be wrong (darned date conversions!). 
 What was the ultimate problem?  I was using ‘greater than’ rather than ‘less than’ inside of my expression.  SQL Server ran fine, because the value I thought was being used was actually something completely different.  Oh well, 5 hours of debugging for an origianl 5 minute change…
As for the lesson that I relearned… Never trust assumptions.  ALWAYS make sure the value you are using is the one the system is getting… Especially when it comes to working with SQL Server’s query window!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s