Category: Blog

  • Back to Work

    It’s strange to be back to work on a Monday, with kids still in the house (they start school tomorrow), after being gone for the last 10 days  from work. It was really gone, as I didn’t process email or mess with work in any meaningful way. I did clean some spam over vacation when others were gone, and I added a few Database Weekly links last week, but I didn’t check SQLServerCentral, edit articles, or do anything really SQL related.

    About the only computer tasks I’ve done since the day before Christmas were a few hours on the Advent of Code stuff I’ve been working on in my spare time, and even that was minimal. I got stuck on a few puzzles, and didn’t have much time to work through them. I’d give it 20-30 minutes, but then break for family time.

    It’s a new year, and I’m starting slow. At least slow this week as I take stock of the publishing queues and start to plan how I’ll proceed forward. As I left last year, there were a lot of new technologies coming from Microsoft in 2016 that I felt I needed to get up to speed on. Some are out, some coming, but they’re a point of emphasis. Like Buck Woody with his Data Scientist work, and Grant Fritchey with R, I’m proceeding to learn more about analytics, including data lakes and statistics, as I move through the year. Particularly I’m focused on Python as the language to use, though from what I see with R, lots of the same libraries and formulas apply.

    I’m also looking to continue forward with the #SQLNewBlogger posts and see if I can inspire some of you to move forward with your own skills and thoughts on how SQL works for you. I’m going to look to get at least 2 posts a month out here, and perhaps more.

    Travel starts quickly, with a week long trip to the UK in two weeks and then SQL Saturday Austin, but other than that, it will be a light quarter for me. Just one event in Feb, and none in March. I am looking forward to that slow beginning.

  • 2015 For Me

    This was an interesting year for me. Certainly a time of change with one kid starting high school, one entering his last year, and one graduating from college. These events signal a bit of a change for me, and have me starting to look forward to a life without kids, where I may work more, or differently, and explore other interests. As I freed up some time, and became a bit excited by changes in learning for my kids, I also kick started some of my learning.

    After lots of puttering, I finally decided to actually get back to writing some code this year. I’ve been working to build small utilities in C#, Python, and M this year. My goal has been to not only improve and expand my skills, but also get back to some software development and observe how this aligns with my work on ALM/DLM for Redgate. It’s been exciting to follow along with the San Diego Tech Immersion Group, Pluralsight, and even the Advent of Code.

    In terms of travel and vacation, this was a pretty good year. Despite some long trips (two 10+ day journeys), I managed travel pretty well overall. Still a bit much as I was worn out by the time November hit, but I learned a few things. I am managing things better for 2016 already, limiting the number of trips I’ll take. I also managed to take almost all my vacation, and spend a few different trips with family. I’ve got at least one big family trip planned next year, so I don’t feel bad about carrying over the 3 days I have left.

    Career wise, I’ve enjoyed some of the changes that have come along in my work with Redgate. I do more development than administration, which I enjoy. I started more as a developer, so getting back to those areas, at least for a year or so is nice. I’m looking forward to some of the changes at Redgate, and am especially interested to see where we go with Ready Roll. I really like the product and that style of work.

    I’m certainly getting older, and felt my age this year more than ever. I struggled to run, even sporadically, and while my surgically repaired knee is fine, I think I hurt the other one playing baseball. We’ll see how it does over the winter with snowboarding, but I am more conscious of how I work and take care of myself than ever before. I think 2016 will be a rededication to building more muscle and improving health. In line with that, I think I may actually get a real standing desk I can adjust to allow me to go up and down during the day. I don’t mind standing too much, but I do get a little worn out and I’d like to have my desktop and laptop set up semi-permanently in one environment. Right now I drag my laptop to a couch or table, which isn’t ideal.

    All in all, a good year. Hope it was the same for anyone reading this.

  • Closing Down for the Year

    Today is my last day of work for 2015. I’m actually proud that I’ve managed to take almost all my vacation (3 days left), and will be enjoying myself next week with my family, taking our holiday vacation in the mountains.

    It’s been quite a year for me. Lots of travel in short spans, some long trips, but also some good breaks. I’ve spent some time learning, and improvind my skills, and at the same time I turned down lots of work that might have overloaded me.

    I think 2015 was a good year for me, and I’m looking forward to continuing some momentum and making 2016 even better.

  • Getting all Yesterday’s Sales, or Finding Midnight Yesterday

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as#SQLNewBloggers.

    I see questions like this regularly. How do I get all the sales from yesterday? I tried using DATEADD(day, –1, getdate()), but I only get some of the sales.

    Many people working with T-SQL know this is an issue. They know that getdate() returns the date and time of this instant (roughly). At the time of this writing, that’s 3:11 pm.

    2015-11-25 15_11_29-Photos

    However if I want sales from yesterday, I really want all timestamps from midnight on. So I probably want code that looks like this:

    SELECT SUM(ordertotal)
     FROM sales
     WHERE SalesDate > '20151124 00:00:00'
     AND SalesDate < '20151125 00:00:00'
    
    

    How do I get the time to be midnight?

    The easy answer is one I’ve been using quite a bit lately to answer questions, and I’ve refreshed my knowledge of the datetime trick. I use a combination of DATEADD and DATEDIFF to get to a 0 based datetime.

    SELECT DateAdd(Day, Datediff(Day,0, GetDate()), 0)
    
    

    In this case, I’ll get midnight yesterday, or 2015-11-24 00:00:00. This is because I’m using 0 as my base date and looking for the days (in DATEDIFF) since that 0 based date. When I add those days with DATEADD to the same zero based date, I get the correct date, but with a 0 based time.

    This same technique works to find the first of this month.

    SELECT DateAdd(Month, Datediff(Month,0, GetDate()), 0)
    
    

    You can also use other datetime values to normalize those times.

    SQLNewBlogger

    This was a quick post. I had answered the question and spent less than ten minutes putting this together.