SQL Prompt – The Power Within

*Photo by Red Gate
*Photo by Red Gate

Come a little closer; no seriously come on over just a little closer as I don’t want to you to miss this. Can you hear me? Good, listen if you are in this Data Professional game for very long than you will have some “go to” utilities when you need them. Over my 14 year career thus far I’ve accumulated many scripts, procedures, techniques, and vendor related products.

One product that has remained steadfast for me over the past several years is Red Gates’ SQL Prompt. If you are already using this utility than you know what I am talking about; if you haven’t then you are missing out. I’m continuously amazed at some of the options the product contains. A brief overview and you will find the following:

  • IntelliSense-style code completion
  • Customizable code formatting
  • Save code snippets
  • Refactor SQL code
  • Tab History – save, search, and recover tabs in SSMS

Why did I bold Tab History you may ask? Well pull up a chair, sit down, and listen up.

The Setting

Have you ever had one of those mornings where you wished you would have stayed in bed, perhaps one might call it a “do over”. Well that was me not long ago; the day was actually fitting as the rain was pouring, had no umbrella present, and forgot the ole key card to the shop. For the ones that know me also know that I quit drinking coffee a while back. Ha, yes, I usually get the jaw drops for fellow co-workers and beyond; if there ever was a day I needed some then it was that day.

I sit down, fire up the laptop, and off we go. I starting looking at my plate and opening up a script I had saved the previous day; or had I?!?!? I go to my repository and nothing, absolutely nothing. As I mutter the words to myself, you got to be kidding me, I dive further into my folder structure thinking I might have misplaced it. Aha (there will be more coming in a future post about this little word), I know what let’s open SSMS and check the most recent files. I know I saved it the day before and I probably just put it in the wrong place. Wait, what, wait a minute – nothing there either.

Well this day is just off to a great start; isn’t it?

The Power Within

As I stand up and start walking to the break room to clear my head, get back on track, and re-asses the events thus far I remember something. SQL Prompt has a built in feature that might save the day. I come back to my desk and look at the following:

Tab History

Tab History – two words. Who knew that they would be so important on a day that started off bleak. I click on the Tab History and complete a search of the word “local” since I knew what was inside the script:

Info

 

Scrolling down through on SQLQuery7 I found my script I was looking for! Yes, if you heard a loud clasp of thunder or the earth moving some more on it’s axis that was me doing a SQL Happy Dance. This one feature saved my bacon due to deadlines that I had to meet the next day.

While this utility is a nice feature, we need to look at the utility in terms of a broader scope. SQL Prompt offers much more.

  • Allowing the ability to write code more smoothly
  • You can customize your SQL Code formatting rules
  • Affords you the ability to save code snippets and better yet share them across your team
  • Refactors SQL code
  • Exploration of your database (another feature I like)

Conclusion

A data professional is always looking for ways to improve their processes and become more efficient. SQL Prompt is a utility that accomplishes that goal. If you are a seasoned vet of it then great; however if you have never tried it then give it a go. You will be glad you did.

I tell you what; check out what my other colleagues have to say on something they learned recently:

On a SQL Collaboration Quest

Four SQL professionals gathered from the four corners of the world to share their SQL knowledge with each other and with their readers: Mickey Stuewe from California, USA, Chris Yates from Kentucky, USA, Julie Koesmarno from Canberra, Australia, and Jeffrey Verheul from Rotterdam, The Netherlands. They invite you to join them on their quest as they ask each other questions and seek out the answers in this collaborative blog series. Along the way, they will also include other SQL professionals to join in the collaboration.

 

T-SQL Tuesday #56 – Assumptions

SQL-Tuesday.jpgQuestion: “What time is it?”

Answer: “T-SQL Tuesday time”

Question: “What time?”

Answer: “T-SQL Tuesday time”

“I can’t hear you?!?!?!”

That’s right; it’s that time again where we come together for a block party T-SQL Tuesday #56 style; which this month is hosted by Dev Nambi (blog | twitter). Dev has garnered a topic around what assumptions we make in our work environment within the realm of SQL.

The Assumption

One of the biggest assumptions I’ve come into contact in many places is the saying, “I’m only as good as my last backup”. While that is a semi true statement it does leave the process unfinished. Let me explain:

Johnny (picked a name out of the air) is given a task to create a new database and with that he designs his maintenance strategy. Backups fall into that maintenance strategy. The new mechanism to take a backup is put into place and we are set; full backups set to run off hours.

At least this is what a lot of data professionals assume; taking a form of backup is fantastic. This post is not meant to go into the details of how to take a backup but based on the assumption that your backups are good. The second half to the equation is restoring those backups.

What? You mean I need to actually test my backup to see if it works. Yes that is exactly what I mean. I have seen several cases where backups are taken and everyone sleeps at night. Then the business unit decides they want to pull that backup; you go to restore the backup and the file is corrupt.

Summary

Don’t just assume that your backups are ready to go. Take a more proactive approach and test your backups. Granted each shop is different with their own standards and regulations; with that said if someone asked you to restore your backup……could you with confidence?

What Is T-SQL Tuesday

T-SQL Tuesday was created by the mighty Adam Machanic ( Blog | Twitter); if you are interesting in hosting a T-SQL Tuesday party or want to learn more about it check out his blog. Let’s get involved and make our community that much better.