Author: way0utwest

  • Apologies to my CI for Databases Attendees

    I have to apologize to everyone that attended my Continuous Integration for Databases talk at SQL Bits. I ran over, a few demos didn’t work, and my machine flaked more than expected. I know those things happen, but I still need to apologize.

    While there were problems with my demos, I should have moved on and gone through things a little quicker as well. I could have cut out, or cut down a few concepts, to get through things quicker. The session is really built for 75 minutes, but that’s no excuse. I need a 60 minute, smoothly delivered, version.

    I also should have run through everything completely after some changes at Red Gate. I only set up part of it, which was a mistake. I don’t know if I’d have caught anything, but I might have.

    I’ll work on getting some video and written content of the presentation up here, and hopefully that will help you understand the concepts, and perhaps start to implement CI with your own databases.

  • Powershell Tips–Showwindow

    Looking for help is a pain in Powershell. I type something like

    help get-process

    execute this and I’m scrolling up and down. Things scroll off the screen and I have to muddle through, meanwhile, my code is at the bottom of the window.

    posh_help

    Even when things stop at the end of the page, like the old man pages in Unix, it’s a cumbersome way to work through something. However there’s a better way.

    help get-process –showwindow

    If I type this, all of a sudden I get a window of help.

    posh_help_b

    I can resize the window, move it, keep it handy on the section that’s relevant when I’m trying to write a piece of code.

    A very handy tip I got from one of the TechEd 2014 sessions.

  • Quick Tips–SQL Prompt Aliases for Every Table

    I love SQL Prompt, and think it’s a great productivity tool. Even before I worked at Red Gate, I love the tool and had a copy before Red Gate bought the technology from the original developer. Recently I’ve run into a few people that weren’t aware of some of the ways in which it can help you. This is a quick look at one of the ways I use SQL Prompt.

    Aliases

    Aliases are used to make code more readable, and shorten the amount of code that one needs to write. Typically we use these to give a short name to a table. Instead of:

    aliases_12

    We could use an alias. Note the “p” after the table below and the change in the column list.

    aliases_13

    Automated Aliases

    SQL Prompt can automate aliases for me. Under the Options dialog, there is an Aliases selection (shown below).

    aliases_1

    Note that I’ve checked the “Assign Aliases” box. This is not checked by default, but once I check it, I get aliases. Let me write a query.

    aliases_3

    I’m about to select my Orders table from the Prompt drop down. Once I click Tab, I’ll get this:

    aliases_34png

    SQL Prompt has added the alias for me. It’s a lower case “o”. If I add another table:

    aliases_5

    I hit tab at this point and I get:

    aliases_6

    I have a new alias of “o2”. Not terribly creative, but it works.

    I have some options for changing these around. Suppose I want to make these upper case to stand out. I can change this in options:

    aliases_2

    Now I add a third table:

    aliases_7

    I hit tab:

    aliases_8

    My new alias is an upper case “P” for the Product table. That gives me a bit of differentiation for my tables.

    I, however, do not like the “AS” keyword. I typically just space my alias after the table. I can change that in options:

    aliases_9

    I’ve unchecked the box and now I add a new table.

    aliases_10

    When I hit Tab, I’ll get a new alias, upper case, but no AS.

    aliases_11

    These are not terribly intuitive aliases, but this does at least clean up your code a bit, so when you see all the column names they aren’t spread way to the right with table names like “ProductDescriptions”.

    aliases_14

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

     

  • Sabbatical–First Reflections

    My company, Red Gate software, has given me a 6 week sabbatical. I’m documenting the time with all the posts under a tag if you want to follow along.

    I’m back in the UK as I write this, having flown over on the last day of my sabbatical. Things were slightly cut short, but I can’t complain at all after having six weeks off.

    I wanted to reflect a bit on the sabbatical right away, and then again later. I’ve set reminders in my calendar for the end of the year as well as next spring to think about what this time meant for me.

    I’ve broken this down in to a practical section that looks at the plan and how things went and then a more reflective section that examines the value and meaning of the sabbatical.

    Learning and Growing

    When I planned this sabbatical, I didn’t have any burning desire to accomplish a single thing. That’s not quite true as I’ve wanted to work on a book, but since I write for a large part of my job, I decided not to make that a sabbatical project. Instead I decided to tackle three things:

    • Take a woodworking class
    • Volunteer for Habitat for Humanity
    • Build a Flagpole

    Going into the sabbatical, I wasn’t sure what to expect. I thought I could volunteer three times a week, take a class a couple nights a week, and quickly build my project. It turns out, like most software estimates, I was wildly optimistic about the time and effort things would require. I also hadn’t accounted for the setbacks that invariably occur.

    Woodworking Fundamentals

    I signed up for a class at a local community college, which happens to host one of the premier woodworking programs in the US. While I have built various projects out of wood for years at home, I’ve never had any formal training on how to use tools and work with wood. I’m completely self-taught, and as I quickly found out, I had no idea what I didn’t know.

    The class was initially a bit of a disappointment as it dealt primarily with hand tools. I had hoped to gain some skill with machines, as I have a number at home. However I quickly found that tasks like flattening a board, and hand chopping mortises weren’t as daunting as they seemed and I picked up a few skills I might never have learned otherwise. I also learned to appreciate craftsmanship and working slowly, marking nad measuring in a new way.

    The class turned out to be a little lecture and lots of lab practice, trying to build skills. It certainly has made me appreciate the speed of skills, but also mourn the crude ways in which they work. Hand tools are much better for many tasks, though they can be slow. I’m only a little over halfway through class, with it continuing through the end of the month. The next couple weeks when I get back will have my busy at night, trying to finalize my project. I’ll continue blogging about that project under the same tag, in case anyone is interested.

    Habitat for Humanity

    I’ve told the story before, but a few years ago I was at dinner with a few couples and someone asked everyone what they’d do if they won the lottery and didn’t have to work. There were a variety of answers, but I struggled with the question. I enjoy working and enjoy my job, but when pressed, the thing that came to mind was working for Habitat to help the world.

    I’ve always admired their mission, and I think helping people find a good, stable, shelter for their lives is important. With that in mind, I decided to volunteer for the Denver affiliate for Habitat. I attended an orientation, and then browsed the volunteer opportunities. In my six weeks, I volunteered 9 times, working at the ReStores, building new houses, fixing old ones, and deconstructing a kitchen for a renovation (and the cabinet donations).

    It was a great experience, and I enjoyed the chance to work with a variety of Habitat employees, Americorps volunteers, and many local people that were volunteering their time. I learned a few skills an d tricks, and while I’m not sure I made a big difference, I know I made some small ones.

    I also had the chance to do some good, hard, physical work outdoors. That’s something I’ve done relatively little of in the last decade, and I learned that it’s hard. I was quite worn out some of those days, and I’m not sure I could have volunteered three times a week with my other projects.

    Flagpole

    The one project I set for myself was building a flagpole out of wood. I’d seen this done on The New Yankee Workshop, and I planned to challenge myself to follow the plan and build the pole. With a DVD and measured drawing, I set out to construct a flagpole.

    When I watched the DVD and thought about it, it seemed as though I should be able to build the pole in 2-3 weeks. However I didn’t count on the delays and obstacles that come into play. Weather was a big one for me, with more rain, on more afternoons, that I can remember in recent years. Those delays cut short my work on quite a few days.

    In the end, I managed to complete the pole and get it painted, though there’s more work to do. I ordered hardware for the pole and still need to construct a base to hold it upright, both things I expect to handle in the next 3-4 weeks as well. The future plans have a flag flying by Labor Day.

    Was It Worth the Time Off?

    This is a question that Andy Warren posed to me a few weeks ago. My wife also asked me last week, “Was it great?”

    Those are tough for me to answer. On one hand, it was a busy time, with lots of things happening each week. It felt somewhat surreal, as though I’d moved on to a new phase of my life. I slipped right into going to school, getting up early or construction commitments, and working on a large project around the house.

    On the other hand, it was very relaxing in that I didn’t have great pressures on me. While I’d committed to Habitat projects, I moved a few around, and I knew I could cancel things as needed. I also paced myself with the flagpole, moving slower than necessary to avoid rework where possible.

    I was proud of myself that I managed to avoid email and work. I didn’t check of log onto SQLServerCentral during the time, except the weekend I flew to SQL Saturday #286 – Louisville. Even then I didn’t process or clear much email and as I return to work today, I’ve got nearly 1,000 emails to clear out from the six weeks. I did continue to check Twitter a bit, though I tried to avoid reading technical pieces that were linked and avoided work discussions.

    I did miss work a bit, and I’m certainly ready to come back. I slipped back into my job, checking a things on Sunday (while waiting for paint to dry) and getting ready to fly to Red Gate and SQL Bits this week.

    However I do feel refreshed. I’m relaxed and unworried about SQLServerCentral, which was not always the case in the past when I’ve taken vacations. I also know some of my worldview has changed. I appreciate my job, the success I’ve had, and I do think that I’ve matured a little in terms of how I see the world.

    Will this make me a better DBA/Developer/Editor/Writer? It’s hard to tell, but I’m certainly ready to dive in and grow my skills, working to educate people about SQL Server, as well as evangelize Red Gate’s products and ideals. I’m also grateful that I had the time off, and I appreciate more and more that Red Gate is a fantastic company.

    All in all, it was a good six weeks of growth and change for me. I’m not dying for another six weeks off again, and I’m not sure what I’ll spend my next sabbatical doing, but I am sure that I’ll take one again in another five years if I have the chance.

     

    I learned more about Habitat, and admire them more than before. They don’t give away houses; they sell them at cost, setting payments and carrying mortgages that enable homeowners to succeed in their lives.

    I’ve also contacted their speakers bureau, thinking that my skill as a public speaker might help Habitat Denver continue to grow in the future.