Author: way0utwest

  • Vocation or Career

    Career: an individual’s journey through learning, work, and other aspects of life.

    Vocation: an occupation to which a person is specially drawn or for which he or she is suited, trained, or qualified.

    Which one describes your current employment situation? How do you feel about the technical work you do? A career is a good thing, and I hope that you all have long, successful careers, I hope you continue to learn and maintain a balance between work and your life outside of your job.

    However a vocation is what I’d hope drives you forward. You find some endeavor that you are drawn towards, and at which you have some skill at performing. As much as I never planned to be a technical writer, I find that I am really drawn to it, and I enjoy the work quite a bit. I’d say the same thing about speaking and presenting to groups of technical workers. My employment is more of a vocation, and certainly much more than “just a job.”

    As you go to work, accomplish tasks and finish projects, think about what you like and don’t like. Think about whether you look forward each day to the challenges you face or you dread each hour. If it’s the latter, then I hope you are making plans to change something. Find a new employer or position. Life is short and you need to remember that you’ll spend a lot of your time at work. Make what you do a vocation and work becomes an exciting piece of your life that enriches your time here.

    Steve Jones

    The Voice of the DBA Podcast

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

    The Voice of the DBA podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. Support this great duo at www.everydayjones.com.

  • Filetable–Moving files programmatically

    I’ve been playing with Filetable and I was asked an interesting question. Can I move files to a folder programmatically?

    It’s trivial to do this in Explorer. Just drag and drop, and I’d expect that most people using Filetable from the client side would do this. I’d even expect that lots of programmers might use Powershell and the

    However suppose I loaded a bunch of documents into the Filetable folder and I needed to move or process them. I certainly could handle this easily from the client, but it’s actually simpler to do this from T-SQL.

    The Example

    Let’s say I have a few files in the root of my Filetable as shown in this image. My Filetable is the Explorer table inside this path.

    filetable_c

    If I check this from T-SQL, I see four rows I my table. Two jpgs and two pngs. The jpgs are books and I want to move them into a separate folder.

    filetable_a

    I decide to set up a folder inside of this structure. I can do that, using the technique from another post to create a folder from T-SQL. I create the “Books” folder and now If I look at how this appears in the table, it’s like this:

    filetable_b

    In the share it looks like this:

    filetable_d

    What I want is to now set the parent_path_locator of the jpgs to be that of the Books folder. However I can’t update that field as it’s a computed column. However I can update the path_locator of the two rows and compute a new HierarchyID value that includes the path_locator of the Books folder.

    The way to do this is similar to how I would add a file to a folder. I use this code to computer the new HierarchyID and update the existing rows.

    DECLARE @path HIERARCHYID
    DECLARE @new_path VARCHAR(675)
     
    SELECT  @path = path_locator
    FROM    dbo.Explorer
    WHERE   name = 'Books'
    
    SELECT  @new_path = @path.ToString()
            + CONVERT(VARCHAR(20), CONVERT(BIGINT, SUBSTRING(CONVERT(BINARY(16), NEWID()),
                                                             1, 6))) + '.'
            + CONVERT(VARCHAR(20), CONVERT(BIGINT, SUBSTRING(CONVERT(BINARY(16), NEWID()),
                                                             7, 6))) + '.'
            + CONVERT(VARCHAR(20), CONVERT(BIGINT, SUBSTRING(CONVERT(BINARY(16), NEWID()),
                                                             13, 4))) + '/'
     
    Update dbo.Explorer
          SET path_locator = @new_path
          WHERE name = 'Cleankill.jpg'

    Once this is done I see the share looking like this:

    filetable_f

    Here’s the root of the share, and you can see my file has been moved.

    filetable_e

    I repeat this for the other file, though I could potentially have wrapped this all up into one statement. This easily moves my files to the subdirectory in my Filetable.

  • Friday Fun

    Someone at Red Gate sent around a request for the current version of our logo. I’m not sure why it changes so much, but it certainly has a lot over the years. In any case, while they got a real response, I sent this one as a joke.

    rglogo1

    I got chastised by another employee, who said it was clearly this one

    rglogo2

    If you haven’t seen our DBA Team series, here’s article 2. Worth a read.

  • Sabbatical Decisions

    My employer, Red Gate Software, offers a sabbatical to their employees, and this year I’m taking mine. I’ll be gone from June 2 – July 14, away from work, but I’ll be blogging here about my experience.

    I wrote before that I had a sabbatical coming from Red Gate Software this year. It’s a fantastic perk, one that grants all employees 6 weeks of paid time off every five years. The time is supposed to help you grow in some way, not necessarily related to work.

    I had lots of comments on my piece, and I’ve thought about it quite a bit. With my schedule at home, and other items on the agenda, I’ve decided to do the following:

    1. Learn something
    2. Help someone
    3. Wander on my own with a project

    Those broad ideas boiled down into these actual physical items.

    1. Take a class at a local community college. I have an interest in woodworking and I’m looking to go through one of their summer classes. I’ve not made the time in the past, mostly because of the distance to travel to the school, but this is a good time to experiment with the idea.
    2. Volunteer with a charity part time. I have a soft spot in my heard for Habitat for Humanity, and I plan to volunteer with them in both their stores, and on some local builds.
    3. Make something with my hands. As I mentioned, I have an interest in woodworking, but I don’t always get the chance to work through a large project with so many other things happening at the ranch. I decided that I’ve wanted to build a flagpole, strictly for me, and that’s my project.

    Now that my surgery is done and I’m on the mend, I’ll be working through each of these, setting up the details and getting ready for time off.

    My sabbatical is scheduled for Jun 2-July 14, though I won’t be back right away as I will be heading to England right away for SQL Bits XII.

    The blog will likely switch from data topics and SQL Server to some progress on the sabbatical so you can follow along if you like. I won’t syndicate these posts over to SQLServerCentral, as they’re not really relevant, so if you’re interested in how it’s going, subscribe here or keep checking back.