Another reason that T-SQL beats the GUI

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
http://www.MidnightDBA.com/Jen

 

4 thoughts on “Another reason that T-SQL beats the GUI

  1. Karen Lopez

    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.

  2. Dave Dustin

    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.

  3. Antony

    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).

Comments are closed.