Author: way0utwest

  • Crossing Azure Borders

    The speed at which Azure is evolving actually amazes me at times. I know that the Azure platform is a focus for most, if not all, groups at Microsoft. The breadth of changes occurring every quarter continue to enhance capabilities to the point where Azure is a viable platform for more and more applications all the time. It’s not for everyone, but it does work well for more and more organizations all the time.

    I’ve been watching the Azure SQL database evolve, and been doing a little work with it for a few years. It has grown from a fairly limited RDBMS to a full-featured database, albeit with limitations. Some of those issues have meant that tools or techniques I’ve been familiar with haven’t worked well, if at all.

    One of those items was the ability to query across databases. Previously I’ve had to open two connections and pull data to a client to combine it. However just recently that with the elastic database query in Azure now supports queries across databases. This is cool, as we can now build applications that easily query across shards, or even just across different databases without requiring additional client work.

    The list of features in an on-premise SQL Server instance that aren’t in the Azure SQL Database continues to shrink. While there’s more work to be done, I think we can start to experiment with systems and see where the Azure platform might support our needs. Certainly our business people like the ongoing rather than capital expense nature of cloud platforms.

    We should be sure we understand where, and where not, we could use an Azure SQL Database. I’m curious if any of you have had success with Azure and what types of applications you use the platform to host.

    Steve Jones

    The Voice of the DBA Podcast

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

  • Baseball Analytics

    I love baseball. In fact, for the last ten years I’ve participated in an adult league each summer, playing 12-20 games each year against other 40 year olds. While we play the same game with the same rules as the professionals, we have a much different outlook on the game, with many of us enjoying the competition and distraction, but often viewing avoiding injury as a higher priority than winning.

    Baseball is an interesting game as the professional season is so long and for over a century there have been a huge amount of statistical data captured about each team. Prior to the fantasy sports popularity explosion, people had leagues that competed against each other solely based on this statistical data. I even wrote a program with a friend on an Apple II that allowed us to set up teams of random players, read in statistics, and then compete against each other using pitching v batting statistics, just showing us text results.

    I ran across an interesting post from a consultant that examined a hypothesis he had about winning baseball teams playing better at the end of the season. Using a free data set, the R language, and a Jupyter Notebook, he was able to perform an analysis that proved he was right. Whether or not you agree with him, I would guess that this analysis didn’t take that long to complete, and was fun as well.

    With R coming to SQL Server and the increasing call from organizations to perform more complex analysis on our data, I think this is a great way to get started. In fact, I’m thinking that I should load up some of the datasets myself and see what kinds of things I can prove or disprove about my knowledge of the game. If nothing else, looking at baseball stats is probably a fun way to brush up my statistics skills.

    BTW: Congratulations to the Kansas City Royals for their World Series win (and to the #sqlfamily in KC).

    Steve Jones

    The Voice of the DBA Podcast

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

  • Adding Extended Properties

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

    One of the things I needed to do recently was add some extended properties to objects. I got the idea of using them from John McClusky at SQL Bits. He had a great presentation on tSQLt that’s worth watching.

    In any case, I wanted to add, and update, extended properties.  I had used SSMS to do this, but it’s cumbersome. I decided to experiment and see how the T-SQL code works. My browsing of Books Online showed me there are a few procedures used, one each for adding, updating, and deleting properties. I decided to start with sp_addextendedproperty.

    This procedure takes some interesting, rather unintuitive arguments. Name and value are easy to understand. These are the name of the property and it’s assigned value. One thing to note is that value is a sql_variant, which should work fine for most situations, but CASTing may be required.

    However the next arguments are level 0, 1, and 2, with a type and name for each. Those didn’t make much sense at first. In fact, as I wrote a few scripts, I had to keep looking up the meanings. Essentially we have three classifications of objects. The outer containers, the objects, and the dependent objects. I’ll explain them below.

    The level0 type is essentially the class of object. Is this an Assembly, a Contract, a Schema, etc. For my purposes, this has always been a schema, but certainly you could add properties to the other classes if you needed them.

    The level1 is the object type that we usually work with: table, view, function, procedure. For me this is pretty much been table, view or procedure, but certainly function is something I’d use as well.

    The level2 is the dependent object: the trigger, the column, the parameter, the constraint. These I haven’t really used, but I certainly think that adding in properties for indexes, triggers, etc are valuable.

    Adding a property is easy. For example, one of the items I add is a PK exception for heap tables. To do that (for the SalesHeader_Staging table), I’d run this.

    EXEC sys.sp_addextendedproperty 
      @name = 'PKException',
      @value = 1, -- sql_variant
      @level0type = 'schema', -- varchar(128)
      @level0name = 'dbo', -- sysname
      @level1type = 'table', -- varchar(128)
      @level1name = 'SalesHeader_Staging' -- sysname
      ;
    GO
    
    

    I can see this easily in SSMS.

    2015-11-02 17_16_53-Table Properties - SalesHeader_Staging

    Properties are great ways to add additional information to an object in SQL Server, though I certainly wish they were more visible in objects.

    SQLNewBlogger

    I knew there was a procedure to do this, and a quick search on extended properties got me to the BOL reference. I was experimenting with adding the properties while working on this, and I had to research the meanings of the parameters a bit, so this took about 20 minutes to get ready for publication.

    Reference

    A few items from BOL

    sp_addextendedproperty – https://msdn.microsoft.com/en-us/library/ms180047.aspx

  • Looking Back at Summit 2015

    Last week was the 2015 PASS Summit in Seattle. It’s the largest SQL Server specific gathering of data professionals in the world, and it’s an exciting week. If you work with SQL Server in the US and have the opportunity to attend, I’d recommend you go. If you’re in Europe, I prefer SQL Bits, but either of these events is exciting and inspiring.

    The week began for me with SQL in the City 2015 – Seattle. As I work for Redgate I was tasked with presenting the event. The day started with my helping our CEO deliver the keynote. We’d done this a few weeks earlier in London, so we’d had some practice. I think the opening went well, and I enjoyed it.

    Photo Oct 26, 4 46 43 PM

    Immediately after I had a session on database version control. There were lots of great questions, so many that I ran a bit long. However it was good to see some great advocates of VCS in the audience as well as people interested in the topic.

    Photo Oct 26, 9 05 53 AM

    I also ran a panel on DevOps and smoother database development. I often don’t like panels, but this is a great topic, and with a number of consultants on stage, we had some good discussions. I would like to see more of these at events, especially with people that are building software successfully. They have great stories to tell.

    The Monday night networking dinner went well. It was a bit crowded at the Yard House, but Andy and I spoke with the managers Tuesday and we have some different plans for next year. However we had over 150 people stop by, which is a great crowd.

    Photo Oct 27, 8 22 43 PM

    It’s always a pleasure catching up with friends who I rarely see in person. Especailly the great Pinal Dave, one of the few that’s been to the ranch.

    Tuesday was a quiet day for me. I went to the SQL Saturday organizer meeting, seeing some changes coming to the SQL Saturday site as well as concerns and requests from organizers. With most of the people in Seattle at a pre-conference session on Tuesday, things were quiet. I also had some rehearsals for my testing talk to go over, so I spent the afternoon in my room going over demos.

    I did take a break for #sqlyoga with Daniel de Sousa. I have come to enjoy yoga, and would like to see some organizations at other events. It’s just as enjoyable as a #sqlrun. It was the two of us and lots of young people in downtown Seattle, but a great break.

    Speaking of which, Wednesday morning I met up with Allen White and a few others for a morning #sqlrun along the water. This has been a bit of a tradition for many people, and we had a good group of 20 or so jogging along.

    The rest of Wednesday was a few lightning talks at the Redgate booth and a couple live practice sessions of my talk in my hotel room. Not very exciting, but this was the end of a stressful month with lots of travel.

    Both Tuesday and Wednesday night have evening events at the convention center. Tuesday is the opening reception, with lots of people milling around a large room with some appetizers and drinks. Wednesday is in the expo hall, with dinner and drinks and the chance for vendors to meet attendees. It was a large crowd both nights, with the chance to see lots of friends in the SQL community and meet new people.

    Thursday had me watching Dr. Dewitt and Dr. Nehme’s keynote on my laptop while I did a little other work. I have to say that the live keynote was probably better, but this was an interesting topic on IoT. You can rewatch it if you missed it. Then I went to a DocumentDB session, supposed to show case studies of who’s using the technology. We heard a little of that, but not much technical detail, and the session went sideways with lots of antagonistic, almost angry, questions from the attendees. I really wish SQL Server people wouldn’t be so upset about NoSQL technologies. They work in places, so let’s discuss where things work well.

    Lunch had me in the expo hall for a bit before taking our Argenis Without Borders 2.0 picture. We raised $25k for Doctors Without Borders, which is amazing. Thanks to everyone that participated.

    Photo Nov 01, 8 02 33 AM

    My session on testing T-SQL code went well. Lots of questions, lots of people. I walked in a few minutes before my start time to find 150 or so people in the room, which was amazing. I thought I’d get 15 people to talk testing, and I’m glad so many people are interested in the topic. Hopefully I inspired a few people to start testing code.

    Photo Oct 29, 4 19 47 PM

    That was really the end of the event for me. I had missed most of lunch, so I went for a short snack before the Friends of Redgate dinner. A late night hour with the Varigence Biml crowd before getting to bed. Then I was off Friday for home, capping off 18 days of travel for the month.

    Photo Oct 30, 8 47 59 AM

    This was a quiet conference for me. With pressures to deliver a good presentation for the first time, I spent more time than I expected getting prepared. However it was great to see so many friends and fellow #sqlfamily people at the event, and I enjoyed the conversations and pictures on Twitter throughout.

    I missed being there Friday, hearing about everything online, but I was also worn out from the month. My apologies if you wanted to say hi and couldn’t find me. Thanks if you took a few minutes to chat with me.

    The event comes back to Seattle next year, and hopefully I’ll spend more time at the event.