T-SQL Tuesday

T-SQL Tuesday #53 Round-up

Logo for T-SQL Tuesday

Welcome back, folks! We had 10 submissions for this month’s TSQL Tuesday, which was based around little tricks inside of SQL Server. Without any further ado, and in no particular order, our entrants:

Riddler, Harley Quinn and the Joker by Pat Loika, on Flickr

The Riddler, Harley Quinn, and the Joker

Massive thanks to all those that participated – and if I missed you, just shoot me an email or a tweet and I’ll get that corrected pronto.

T-SQL Tuesday

T-SQL Tuesday #53 – Why So Serious? (Announcement)

Logo for T-SQL Tuesday

T-SQL Tuesday is coming up on April 8th, and Adam has given me the honor of choosing a topic for our next blogging party for a second time. Given that this announcement is occurring on April Fools’ Day, I figure it’s a perfect time for a theme:

Dirty Little Tricks

The Joker

The Joker

Your mission, should you chose to accept it, is to come up with a piece of T-SQL that could mess with your coworkers. And if you’re committed to the fun, implement it!

Need some ideas? Maybe you could…

  • Write a lengthy script that returns a funny or annoying message
  • Implement hilarious login triggers
  • Use Resource Govenor to limit your victims developers

Honestly the sky is the limit. Just be sure to blog about the results of your trickery if you do pull it off.

Special Warning

Folks, don’t get yourself fired. This is meant to be fun. But you know your work environment better than I do. If your job has a stick up its rear-end, just write your tricks down and keep them up your sleeve for when you’re working at a more relaxed place.

And I shouldn’t have to say it, but don’t do this sh!t in Production.

The Rules of the Game

  1. Your post must be published between 00:00 GMT Tuesday, April 8, 2014 and 00:00 GMT Wednesday, April 9, 2014.
  2. Include the T-SQL Tuesday logo at the top of your post, and have it link back to this announcement.
  3. Leave a comment here with the link to your post. It makes it easier for me to find who is participating.
  4. If you’d like to host a T-SQL Tuesday of your own, review the historical list of topics, and reach out to Adam Machanic for scheduling.

Good luck on your tricks! Don’t get fired!

Harley Quinn

Harley Quinn

T-SQL Tuesday

T-SQL Tuesday 51: Bad Bets

Logo for T-SQL Tuesday

T-SQL Tuesday

It’s been an incredibly long time since I last blogged, but this month’s T-SQL Tuesday topic was so juicy, I had to throw down. This month’s event is being hosted by Jason Brimhall and is on the topic of risky bets in IT.

I’m sure I won’t have the best or most outrageous stories, but I do have some fun ones to share. These are all small anecdotes from different employers and consulting situations, and I am going to keep details as anonymous as I can to protect the innocent. In no particular order…

  • Internet Troubles

    When I first became a DBA, I was tipped off that if SQL Server was having trouble, I could restart IIS to fix it.

    Obviously I got better information.

  • RAIDless

    In one completely virtualized environment, I eventually discovered that the underlying storage supporting all the VMs was a single RAID 0 configuration.

    My memos and pleas went unheeded.

  • RAID Master

    In a different virtualized environment, the sysadmin set up all the underlying storage in a RAID 6 configuration without asking for input from anyone else. At least we’ve got extra parity protection…

    Pretty sure that RAID 6 is still chugging.

  • Size Queen

    On one longer term contract, I was taking a look at database configurations. I discovered one that had a data file only 3MB, but its log file had grown to 65,000 times that size (roughly 190GB).

    A pretty common, though egregious occurrence, of a database in FULL recovery without log backups. Backed up the log, shrunk it, put the database in SIMPLE recovery, got a coffee.

  • Copy-what now?

    I lied, I saved the best for last. I had to quit a job over this one.

    I was working freelance when the owner of the company told me about a new project – an eCommerce site for equipment operation manuals. As I am given the files, I realize that the operation manuals in question belong to famous companies for products still in production. Manuals one could download from the internet freely via product support pages.

    I mention this to the owner, but no changes are made to the project. I inform the owner that we can’t take on the project. The manuals are copyright to these corporations, and we cannot distribute the files – much less sell them – without permission from these corporations. The owner nods in understanding.

    The following day, the owner mentions to me that the client does have letters of permission from all these corporations (well over 100 companies), and that the owner has seen them. I ask to see them, but the owner doesn’t actually have them on hand. I still can’t start on the project until I’ve seen the letters.

    Nothing has moved forward in a few days’ time. The owner flat out inquired, “Are you serious that you won’t do this project?!”

    Unphased, “Correct, I will not complete this project as it’s against the law.”

    “But my lawyer says it’s fine,” the owner countered.

    “And my lawyer says it’s illegal.”


    “Well I can’t keep paying you if you won’t do this project,” the owner mentioned. An ultimatum.

    “I understand,” I said. “I can finish out this week while you find someone else to take over.”

    Thankfully I already had another job prospect that was just about to land at that point.

Those are my anecdotes! I hope you enjoyed them! Check out the other T-SQL Tuesday posts in the comments section of Jason’s blog!

T-SQL Tuesday

T-SQL Tuesday 48: Expectations, Widgets, and APIs

Logo for T-SQL Tuesday

T-SQL Tuesday

This month’s installment of T-SQL Tuesday is brought to you by Jorge Segarra, and he’s asked about our opinions on the Cloud. The company I work for, Sanametrix, does all of its work in the Cloud; in fact, that was one of the main reasons I took the position. Additionally, at this year’s PASS Summit, I was selected to give a talk about automation in the Cloud via PowerShell, so you can say that I’ve already drunk the Cloud koolaid.

All that said, the Cloud isn’t some magical thingamajig where in all performance, scale, and unicorns reside. At the best of times, the Cloud is adequate at what it can do for you, and at its worst, it’s expensive and slow. And as I point out in my Automation in the Cloud talk, it’s fantastic for developers and for deployments, but it doesn’t offer that same flexibility and scalability towards typical database tasks.

The Cloud requires the management of expectations. If you take a look at the different kinds of machines you can buy in EC2, you’ll notice that the majority of them (13 of 18) offer less than 60GB of memory. Most have 8 virtual CPU cores or less. For database professionals, those statistics can be alarming especially for those of you who work in Fortune 500 or any other large enterprise company. But for many small businesses, non-profits, and educational agencies, that’s probably on-par (or greater!) than the processing power of their current servers. And they no longer need to worry about powering those servers, licensing those servers, or even hiring a sysadmin to care and feed those servers. True, for the same amount of money spent each year, they could have bought a more powerful, physical server, but the Cloud is great at shifting all these different costs into a single package.

Even though you’ll be stuck with smaller, less powerful servers in the Cloud (unless you’d like to pay a premium…), that doesn’t mean performance is lost. People and companies are building fantastic, quick apps that rely on the strengths of the Cloud, namely, that it’s not just a single service, but a whole host of complementary offerings. As I’ve pointed out in my Automation talk, think about the Cloud as a collection of services, each tuned specifically for a different task. So while you might use EC2 as virtual web and application servers, you could be storing your relational database in RDS, running your data warehouse with Redshift, and sending email notifications with SES. Each of these different services has been highly tuned to perform well at a specific task, and by separating what your application does across different services, you aren’t going to overwhelm your processing servers with “too much to do.”

Even more than separating function, I think these “widgetized” services really show how the Cloud is “of the web” as it were. One reason the Cloud has been so popular in the start-up world is because those companies can scale their computing power along with the size (and popularity) of their business. But another reason is because many start-ups have technical founders who are web developers. They’ve cut their teeth on HTML, CSS, and Javascript, and are using those same technologies to invent new ones, such as Node.js. But growing up on the web, these developers know that information is never more than an API away, whether they’re adding a Twitter feed to a website, or wiring together the back-end of their latest webapp using AWS’ APIs. All these services are callable and programmable through code, and it’s a wonderful way to work once you’ve gotten the hang of it. (Seriously, put away the wizard once and learn how to do an automated install or deploy a server via PowerShell. It’s addicting.)

Finally, the Cloud isn’t for everyone. If you’re at one of those large enterprises, you should have your reservations. For all those start-ups gaining traction in the Cloud, there are some that have grown up and are moving on-premise in order to save money. And for most companies, it’ll be a split: some resources will stay in-house while they look to the Cloud for additional processing power. But as long as you are honest about the trade offs and managing expectations with business users appropriately, most people are happy with what the Cloud can do for them.