Author: way0utwest

  • A New Use Case for SQL Prompt – Shrinking Code

    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.

    I thought this would work, but I wasn’t sure. I saw some code the other day like this:

    DECLARE @char AS CHAR(1); SET @char = NULL; SELECT ISNULL(@char, 0); SELECT COALESCE(@char, 0); SET @char = E; SELECT ISNULL(@char, 0); SELECT COALESCE(@char, 0);

    I dropped it into SSMS, and of course, I couldn’t read much of it. I did a quick CTRL+K, CTRL+Y and it looked like this:

    DECLARE @char AS CHAR(1); SET @char = NULL; SELECT ISNULL(@char, 0); SELECT COALESCE(@char, 0); SET @char = E; SELECT ISNULL(@char, 0); SELECT COALESCE(@char, 0);

    Yeah, SQL Prompt. In addition to reformatting as I prefer, it removed the extra whitespace.

  • In and Out

    Travel always causes issues with work. It was the same when I was a production DBA as it is now as editor and evangelist for Red Gate. The tasks I have to manage and complete don’t seem to ever be scheduled with the idea that I might be away from my desk.

    I was off Monday with holiday and family celebrations (and the last ski day of the ’14-’15 season). I also leave Thur morning for SQL Saturday in Huntington Beach and will be gone until the weekend.

    As an editor of what’s essentially a newspaper, the issues must go out regularly. That means that last week before I took time away I had to ensure that I had newsletters scheduled for Fri-Tue, as well as working on content for this week. That compresses the schedule of tasks, with more being done before I leave. Today I need to catch up things that occurred while I was gone, as well as prep for tomorrow and Thursday. I’ll also need to get enough done that I have things scheduled for Friday and Monday.

    Time management can be hard, and over the last 10 years I’ve learned a few tricks to ensure I can handle the variety of tasks that come my way. What has worked for me is to take some of the lessons from the Boy Scouts and apply them to work.

    Be Prepared

    For those items I need regularly, I have learned to look ahead and always have a couple items prepared. This mainly means questions, articles, and editorials. Since I’m not sure what will happen in a week or two, my plan is always to hold a few items back and ensure I have at least a week’s worth of items planned.

    Like my son works on merit badges, the other thing is to regularly work on items I need rather than wait until I need them. My son often completes a work requirement before he needs it. I may have to remind him, but he’s learning to adopt that on his own. I do the same thing at work, writing, editing, soliciting content before I have the actual need.

    Vacation Isn’t Free

    Perhaps it’s an American thing, but it seems that vacation is rarely a free gift of time away from work. Even when I worked at a job that was 9 to 5 and few hard deadlines, I still found the need to prep systems or people for my time away.

    In addition to the daily work.

    There are others on staff at SQLServerCentral that help me out and I really appreciate the time, but there still is an additional load for me to prepare to be away. It helps to tackle this like saving for vacation (or the future).

    A little at a time. On a regular basis.

  • Kanban

    With more and more software developers trying to find ways to better build software, we have seen many new methodologies and processes being used for managing workloads, tracking development progress and more. Perhaps one of the most interesting adoptions for companies looking to speed up their development has been the use of kanban boards for tracking work in Agile or Scrum systems. Kanban came about as part of the manufacturing process at Toyota and proved very valuable for them.

    We use kanban boards all over Red Gate, for everything from software development to marketing campaigns, to books we’re publishing. It’s kind of amazing. However I hadn’t thought about using one personally until I saw this piece on LifeHacker (a related piece on visualization as well). It’s hard to know how well this would fit for me to manage my workload at SQLServerCentral. While we use a kanban board for a few tasks, like Stairway Series, I think this would be a bit complex for the variety of tasks I deal with on a regular basis. I suspect I’d need a number of kanban boards, a separate one for each type of work, and then I’d be trying to somehow manage my workload between all of them.

    However I do think that for software development, and for a limited set of tasks that you want to track and organize, kanban is a good way to easily visualize the workload. I also think this could be a good way to manage your career learning. Set a list of things to learn, break them down into tasks (watching videos, reading an article, writing a CTE) and then track your progress across the year.

    Having a visual reminder can be motivating, as long as you can make progress and see work moving through progressions. If not, it can be another source of pressure or stress that you avoid. However it’s an interesting technique that might work well for teams that are focused on a single set of work.

    Steve Jones

    The Voice of the DBA Podcast

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

  • The Devil’s in the Details

    This week I was scanning through a number of SQL Server posts (in between working on April Fool’s Jokes) and a couple of them caught my eye. They dealt with simple subjects, but subjects whose details are important. I’ve often found people have had performance issues in SQL Server because of simple misunderstandings of how the system works, or because not enough weight is given to the impact of small details.
    Kimberly Tripp (of SQLskills) wrote a basic post on parameters, variables, and literals, which would think most programmers would understand. However I realize more and more that lots of people that write code in the world taught themselves. That’s amazing, but it does mean that people have many different holes in their knowledge. What I might consider basic or common knowledge might be something that another person never had been exposed to. In any case, Kimberly does a fantastic job of laying out the differences in these three concepts, how they work side by side, and how the choice can dramatically impact performance of your code. Read this one.
    The other post this week was a fairly simple post on data conversions by Rob Sheldon. Again, precedence and conversions are something I dealt with when writing C code, and you do not want to get things wrong there. However many people might not have the same background and wouldn’t understand by varchar and nvarchar wouldn’t be a basic, simple conversion with little cost. Or why the type of conversion might result in far different results than you expect. Since we often test with one set of data and our application work with a (much) wider set of data, this one is a must read as well.
    There are so many things you should consider when writing code it’s really a constant and regular effort to improve your skills in this business. You won’t learn everything, or learn something every day, but pick things up and practice with them. Learn to build better code, one technique at a time, and cement that knowledge with actual implementation in your work.
    You’ve got at least two new things to look at this week, so pick one and try to ensure your code next week considers these details.
    Steve Jones