Home » sql server »sqlserverpedia-syndication »SSC »Tips »TSQL » Currently Reading:

Another reason that T-SQL beats the GUI

November 14, 2011 sql server, sqlserverpedia-syndication, SSC, Tips, TSQL 4 Comments

In IT, we have a few very solid and universal principles that no one ever argues with.  The first of these is Cover Your Ass (CYA). CYA is so universal and popular because things go wrong, blame gets thrown, and DBAs find themselves under a metaphorical bus.  Nobody likes the underside of that bus. It’s far better to proactively protect yourself.

In among my CYA toolbox are such handy items as:

  • Jobs and tables for monitoring and logging
  • Code reviews (mine and others’)
  • Regular security audits
  • A log of issues and actions taken in production

Keeping this kind of log is slightly more work than not keeping this kind of log. But it has become a regular habit, and it pays for itself time and time again. 

For true CYA effectiveness, you really have to record exactly what you did in the production log…it’s not enough to write “updated table1 data as requested”.  Oh no no, when something breaks and they say “what did you do to the database??”, you’ll be most comfortable (and have the greatest right to smugness, if that’s your thing) if you show them THE EXACT update statement you ran.

I’m very strict about this. I just had a request to change a user’s login. That’s a simple, harmless little thing to just pop out in the GUI, but it’s just as easy to write and save ALTER LOGIN [mydomain\Bill.Whit] WITH NAME = [mydomain\Bill.White];

CYA: Just another great reason to eschew the GUI.

Happy days,
Jen McCown


Currently there are "4 comments" on this Article:

  1. Yea! Death to the GUI!

  2. Karen Lopez says:

    So not being a DBA and being very experienced in IT (old), I do use GUI. But all the tools I use allow me to review the TSQL first, then cut and paste it into log/change request/whatever.

    Again, because this isn’t my full time job, I’m not going to memorize all the syntax for everything I do.

    We also usually have a process that requires that changes in production require a script, not live. So again I use a tool that helps me do a proper script. Even if it is one statement.

    Maybe using GUI like an idiot is too tempting. Using the right tools seems to be important.

  3. Dave Dustin says:

    One of the major advantages of writing the T-SQL directly rather than using the GUI is that if you have SSMS Tools Pack installed, you then get a log of all the commands executed.

    Not quite a official as a log or run book, but a good way to check what you actually did, vs what you think you did.

    Plus you never know when you need to do that “one time only” operation again.

  4. Antony says:

    I never use the GUI if I can avoid it, for three reasons:

    1. If I don’t know how to script something I need to do, its an opportunity to learn.
    2. If I write a script, I can save it for later use/reference/auditing/whatever
    3. The GUI doesn’t give you all the options, and its not always obvious what its doing behind the scenes (editing tables is a great example of that).

Comment on this Article:

Minion Reindex by MidnightDBA is here!


Excellent Index Maintenance

Download Minion Reindex, log feature requests, read documentation, and sign up for the newsletter at MidnightSQL.com/Minion!

Monday, Oct 27 12:00PM CDT: Attend the Minion Reindex Intro Webinar.

MidnightSQL Consulting

Need help? Got an emergency? Write us at Support@MidnightDBA.com!

We can schedule time to help with your backup/restore issues, high availability and disaster recovery setup, performance problems, and a great deal more. Very often, we're even available on the moment for downtime issues and emergencies.

For more information about MidnightSQL consulting, email us or check out www.MidnightSQL.com. Happy days!

Where are We?

November 3-7: PASS Summit, Seattle, WA

PASS Summit: Jen is presenting How to Interview a DBA: A Panel Debate on Thursday 11/6 1:30pm, room 401 (along with Adam Machanic, Sean McCown, Bob Pusateri, and Michelle Ufford).

PASS Summit: Sean is presenting Performance Tuning Your Backups on Wednesday 11/5 3:00pm, room 602-604.

December 11: Presenting "Powershell Cmdlets.." at Alaska SQL Server User Group

January 30: "Become an Enterprise DBA" precon at Austin SQL Saturday

Blog Posts by Category


How to Eat Pop-tarts
Watch DBAs@Midnight live on Fridays,m 11pm Central time

The best database career advice you’ve never heard!


The DBA Roadmap Seminar is 7 MP3 tracks (over 5 hours!) of insider guidance on your database career. We'll teach you how and what to study as a DBA, weigh in on controversial resume debates, teach you to recognize a worthy recruiter, and discuss the new professionalism of interviews. Also some bonus materials, PDF companion guides, and really spiffy intro music!

Once your $99 PayPal payment is submitted, you'll get the download link in e-mail! (Download is a 370Mb ZIP file.)

Become a DBA. Become a BETTER DBA. Use the Roadmap.

Visit www.DBARoadmap.com for info, forums, and more!

Add to Cart View Cart

Cunningham’s Law

"The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer."
Relevant: http://xkcd.com/386/