Author: way0utwest

  • Debugging SQL Server

    One of the tools that I found useful early in my development career was the debugger. Being able to track the values of variables, check the call stack, and pause execution of programs was handy. Early in my career, the tools were very rudimentary, but the latest debuggers in Visual Studio are quite advanced. I remember using a great debugger in Rapid/SQL years ago that helped me with some SQL Server 2000 code.

    There are debugging tools included with SQL Server, but the last time I used them, they seemed to be a bit flaky. However the need to follow your code slowly along it’s execution plan hasn’t changed. I’m curious this week, what many of you do inside of SQL Server to debug your code. I wanted to ask you this week:

    How do you debug your applications that work with SQL Server?

    These could be .NET applications that query the database. You could have ETL processes using SSIS or some other tool that you work on. Perhaps you have a system that runs entirely inside SQL Server and you need to untangle your T-SQL.

    Do you use Visual Studio tools? Have you configured the T-SQL debugger? Are you a PRINT statement or temp-table-for-results developer? Perhaps you have logging or some other mechanism that you use?

    Let us know this week what works well for you, and if you’ve found a particular technique to be handy in a situation, we’d love an article that might teach someone else how to debug their code.

    Steve Jones

     

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 1.7MB) podcast or subscribe to the feed at iTunes and LibSyn.

  • Just In Time

    I’m glad my new laptop shipped and should be arriving shortly. I saw this on my current Lenovo

    alptop

    I had taken my laptop downstairs and noticed the battery was low. I grabbed the adapter, plugged it in and didn’t think about it. However when I disconnected the power, I got the “low battery” message again. I was surprised as the machine had been plugged in for a few hours. When I hovered over the battery icon, I saw the tip above.

    I’ve tried removing and replacing the battery, and I guess the battery could be dying, but on a previous Lenovo, when I got this it meant a motherboard issue. The internal connectors weren’t working anymore and apparently the repair guy had seen this quite a few times over the years on laptops. As they age, apparently this is one area that fails.

    Replacement of the motherboard for that machine was $1000. It looks like it’s $500-600 for this one, and with all the wear and tear I’ve put on this machine, it’s time to just replace it.

    I suspect with all the presenting and traveling I do, I should be happy with about a 2 year refresh cycle.

    Now I just need to hustle and get my new machine here and set up. I should have two weeks for prep before I travel to Germany for the SQL Konferenz. Fingers are crossed.

     

  • A Little Empathy

    In the past, there have been times as a DBA when I’ve been annoyed by the clients submitting tickets to IT. I’m not sure if those incidents were more frustrating than the work I’ve done as a developer for customers, but both can be very annoying and stressful for an employee. I’ve probably acted poorly and said things I didn’t mean while I was upset. I hope I’ve learned to do better by now.

    Things were worse earlier in my career, mostly because over time I developed a more perspective and empathy, both of which Tim Mitchell talks about in his post on perspective. I learned that no one was intentionally trying to be difficult. Each customer or client had their own tasks, and often it was technology that was slowing them down. The only reason they asked me to do some work was that they couldn’t get their work done.

    Much like Tim, I learned that technology doesn’t exist for technology’s sake. If you just want cool technology handling a task, buy a Raspberry PI or Arduino, get some sensors, and build something amazing. However, if you want to be successful in Information Technology, and have people value your applications, systems, and services, learn that you need to solve problems. Learn how to make other people’s work easier.

    I’ve had plenty of success in my career by following Tim’s advice. I’ve made myself part of the business and learned how I can address the problems and challenges faced by others after I’ve learned what those issues are. I’ve also learned that just asking a business person to tell me what to do often results in neither of us being successful.

    Steve Jones

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 2.1MB) podcast or subscribe to the feed at iTunes and LibSyn.

  • Execute the Current Statement–SQL Prompt

    I work for Redgate and write about products. I’ve got a series of SQL Prompt posts here on little things I like. SQL Prompt might be my favorite tool.  SQL Prompt will be yours as well if you give it a try.

    This is a great little feature in SQL Prompt that I wrote about at SQLServerCentral. It’s Current statement Execution, which comes about from pressing Shift+F5. Whatever statement the cursor is on, whether it’s a single line or multi-line, the statement will execute.

    It can be on the first line:

    currentstatemnt_e

    the last line

    currentstatemnt_f

    the end of the line

    currentstatemnt_g

    It doesn’t matter. When I press Shift+F5 in all of these cases, I get this:

    currentstatemnt_c

    Only the second statement executed (the SELECT), the first statement is ignored (and all other statements) and the code executed is highlighted.

    As mentioned at SQLServerCentral, there’s a caveat. This isn’t really highlighting, it’s just coloring. Read the article to understand the difference.

    I also have a video version of my tip.

    You can see a complete list of SQL Prompt tips at Redgate.