Find your lost query

So I come in to work this morning and apparently my PC rebooted. No problem right? Wait, I had a query in SQL Server Management Studio that I needed and didn’t save! What do I do? Oh there might be something saved in C:\Users\username\AppData\Local\Temp … Nope! Aaaack!

Here’s the solution:

SELECT execquery.last_execution_time AS [Date Time], execsql.text AS [Script]
FROM sys.dm_exec_query_stats AS execquery
CROSS APPLY sys.dm_exec_sql_text(execquery.sql_handle) AS execsql
ORDER BY execquery.last_execution_time DESC

That script will give you a listing of every query that was run on the server in the last 24 hours. So as long as you executed that query at some point, you can find it again.

Note: it doesn’t work if your SQL server has restarted or the query plans have been dumped from cache

Education and Expectations

I’ve had a number of conversations over the last few days that have made me think about the value of education.

Education has been billed in our society as the great equalizer.  Get a degree, and get a great job.  We come up with statistics about how much more money you’ll make if you just get a college degree.  At the same time we have a trillion dollars in student loan debt and college graduates who are making coffees with whipped cream as their current career.  What’s going on?

To start with, not all education is created equally.  We’ve all heard of, or met, people that got a bachelor’s of arts in 20th century history and can’t find a job.  It’s no surprise.  There aren’t jobs that use that degree.  All it prepares you for is to continue schooling, eventually get a doctorate, and then settle in as a college professor.  I love history, but I know that it’s not a valid college major unless that’s the job I want, and let us not forget, there are only so many professors of history out there.  Want a job? Get a college degree in science, technology, engineering, or math. estimates that there will be 1.4 million new computer programming jobs over the next decade and only 400,000 computer science graduates.  I don’t know how accurate the numbers are, but that looks like good odds to find a job.  A company we’ve worked with in the past conducted an evaluation of .NET developers in the Sioux Falls region, and found that unemployment among that group was at 1%.  (They also found that the people who were unemployed were people you didn’t want to hire.)  It used to be that a college degree wasn’t required to make it.  My grandfather rose through the ranks of his company to be regional manager of a a manufacturing company and he never finished high school.  Those days are over.  More recently it was “get a degree, get a job” and it didn’t matter what degree.  All you needed was the piece of paper to get that great job.  Now you actually need training for the job you want.  So don’t go to college and figure out what major you want, go to college and figure out what job you want, so that you can get the degree that gets you that job

Secondly, at some point we as a society decided that everyone should go to college, and I say this as a guy who has a Master’s degree, but that’s just not true.  I don’t know why we decided that.  Maybe it’s an extension of the “everyone’s a winner/participation trophy” mentality, or maybe it’s just unrealistic expectations of what people are capable of, but it’s become a real problem.  We end up with people in college that really don’t have a reason to be there, and while they may end up with a degree, they also end up with a LOT of debt.  There’s something like a trillion dollars in student loan debt right now (I have my fair share) and if that debt doesn’t lead to a career, then it’s really bad.  If you’re taking on student loan debt in an effort to further your career, and you have a fair certainty that it will lead to advancement, then it’s reasonable to do that.  It’s much like taking on a mortgage to get a house.  Yes, it’s a lot of debt, but you get a house out of it, and as long as the house is sturdy and well-made, it’s a good investment.  On the other side is taking on high-interest, debt for marginally useful things, like buying consumer goods on a credit card. Right now, the US Bureau of Labor Statistics says that the unemployment rate is 6.6% (source), which is lower than it has been recently, but plenty of people will tell you that has as much to do with people dropping out of the work force as it does with people actually finding jobs.  Now, if you have the means to go to college and get a degree for a career related field, I think you should.  The studies are right, you’ll earn more (on average) than if you don’t get the degree, but maybe stop and think about whether that’s the road you want to go down.  Maybe what you should be doing instead is getting training for a career.  This applies equally to people who are stuck in low-paying no-future jobs.  I know a guy who had worked for a number of years at a local call center.  It’s just my opinion, but that’s a lousy job.  He’s married, and has kids, but there’s just not a lot of future in call center work.  A few weeks ago I was talking to him and he said he’d started training as an electrician’s apprentice.  I was really excited for him.  Electricians are a vital part of our society, and they’re certainly not going to be phased out as many manufacturing jobs have been.  He’ll have a job that you can make a career out of, and be proud of.  (If your calling in life is to be the best call-center operator ever, then stick with it, but this was great for him.)  If you’ve kept up with anything that Mike Rowe (of dirty jobs, and narration fame) is doing, you know that he touts the availability of 3 million current jobs that are unfilled.  They’re skilled labor jobs, many of which require hard physical labor, but they also pay well.  (think welding, plumbing, etc.)  Welders with a few months of training can earn more than $100k annually if they’re willing to work hard, which makes thousands of dollars in student loan debt look less attractive.

Look, everyone has to find their own path in life, and some people should go to college and get educations that will allow them to pursue their dreams.  Other people should go get training for a job they’d like and succeed at that.  (Everyone should finish high school.)  Go into life with realistic expectations, don’t expect to get a job just because you have a degree, and don’t think that not having a degree limits your potential.


We host a fair number of websites and right now we’re doing it on cloud-hosted virtual machines. (I continue to be intrigued by Azure Websites)  As a matter of practice only a couple people in the company have access to most of the machines, but occasionally a site needs to have its application pool recycled so that the startup code runs.  I found a great tool called Servant for IIS that allows you to make changes to basic IIS settings through a web interface.  It runs in a separate process on a different port than IIS, so you can configure firewall rules appropriately to control access, but once installed it allows you to make changes to things like app pools, bindings, and other basic settings.  It’s got a great and simple interface, and just works.

Software Developers and Jobs

Here’s a bit of truth: we as developers tend to job hop a bit.  It isn’t always an ideal situation but it’s just how our industry is.  Experience is worth so much that wages often can’t keep up.  My first job was at a bank where everyone got a raise of a few percentage points each year.  That’s fine for most jobs, but because of the value of good developers, I was able to leave the bank after 3 years, and get a 40% raise by moving to a new company.  Now the bank certainly had the money to pay me that much, but because of their corporate culture, they couldn’t give me that kind of raise.  It’s something we see over and over again.  Good developers leave for new jobs because their current employer won’t give them the money they’re worth.  I don’t know what has to change among employers to convince them to pay what their employees are worth, but a good developer’s value isn’t based on what they’re currently making, it has to be based on what they could get in the market (at a different employer).

Now, there are a few things that play into the tendency to job hop.  First, in my region, developer wages have been lower than the national average for at least 10 years.  That’s partly due to a lower cost-of-living, but it’s also partly just artificially low.  To the benefit of those of us in the region, that’s starting to change.  That makes it difficult for employers when their previously happy employees are now asking for $20k raises, but it’s hard for me when gas prices suddenly go up $0.30 per gallon too.  Sometimes that’s just what happens in a free market.  So here’s an employer and now their employees want raises to do the same job, either you pay them, or they leave.  One of those is a lot cheaper for the employer, and I can guarantee it’s not going through a hiring process.  It also happens because the talent pool is shallow.  A partner of ours recently did a job market evaluation and found that the unemployment rate among .NET developers in the Sioux Falls region was about 1%!  (That 1% was basically unemployable)  That shallow talent pool also drives wages up.  Now, there will always be people who are looking for more money, and in fact I’ve never met a person who couldn’t use more money.  Money isn’t the only thing we get from jobs though, and there comes a point where more money isn’t the only evaluation we’re making when we look at our job opportunities.

The second thing that tends to play into job hopping is boredom.  At some point in most jobs, you’ve learned all you can from the people you work with, and from the things that company does.  Unless you’re constantly challenging yourself to learn new things, you’ll get bored with the mundane details involved in the day to day stuff.  Most of us that are programmers got into the job for the problem solving aspect of it.  While we’re aware that we have to do the boring parts (and the yak shaving), we don’t want to be stuck in that all the time.  Instead we want to work on new technologies, and innovative things.  This falls partly on the developer to stay motivated, and partly on the leadership to give those people opportunities to do interesting things.  I’m the lead developer where I work, but I have to give my teammates things to do that challenge them otherwise they get bored and start looking for new opportunities to learn.  (There are some developers who got in the business because they knew they could get a paycheck and are just interested in keeping their job easy.  This doesn’t happen to them.)

Finally, people move to a new job because of opportunity, and really opportunity for advancement.  I recently had a good friend of mine leave because he got the opportunity to be the lead developer at a different company.  I couldn’t give him that opportunity here, and neither could my boss.  We’re not a big company and we don’t have a need for two lead developers.  Sometimes people are just going to get better jobs, and there’s nothing you can do to keep them.  Again, that’s part of a free market.  This is why you hope people leave though, because they’ve succeeded at your company and are going on to bigger and better success.

Our industry has always had some degree of people moving from job to job, and it seems to be at a higher rate than most other professions, that’s partly because of the value of experience, and partly because of pay, and sometimes just for new opportunities.  Hopefully we can all find a way to pay the people we have what they’re worth, keep them interested, and give them the opportunity to succeed.