Category: Blog

  • The Desktop Rebuild–Part 1

    I’ve had an aging desktop for some time. I originally bought it from Glenn Berry (b | t), who I think gets a new machine every quarter or two. Seriously, I think there is a computer in every room of his house, and he has a lot of rooms.

    In any case, I had an i7-930, 24GB of RAM, and 4 drives with about 3TB of storage. However, the CPU was aging and I’d get temp alarms when doing heavy video processing. In the last 4-5 years, I’d replaced the power supply and CPU cooler, but still had issues. The Windows 10 upgraded added more, with some weird freezing and loss of the Start menu. I didn’t have all of those things on my laptops (both w10, one new, one upgrade), so I decided it was time to rebuild when a simple Skype call had temp alarms going off.

    Glenn is my hardware guy. If I have a question, I ask him, mostly because I don’t care about cool hardware and just want things to work. Glenn recommended these items (some of them), and I drove down to the local Microcenter after my Skype call finished.

    Photo Jun 23, 5 39 33 PM

    I purchased

    • ASRock Z170 Extreme6 motherboard (recommended) – $160
    • i7-6700k CPU ( recommended) – $290
    • CoolerMaster fan – $35
    • 32GB Corsair Ballistic RAM – $150

    I know I could find better prices, but I wanted this done quickly. I also needed a new video card, but I delayed that for now. I wish I hadn’t.

    After a few hours of work, and a day (filled with family commitments), I sat down with parts.

    Photo Jun 23, 5 42 30 PM

    I made sure my Crashplan was up to date, and my cloud services were sync’d. I’ve tried to do this in order to become productive quickly on new machines. I also had a new SSD that I’ve been traveling with, but I repurposed that as a new boot drive. The old one was 256, and this was 1TB, so I won’t be in danger of running out of space, something that I was close to doing on the old machine.

    I disconnected everything and pulled out the old (dusty) motherboard.

    Photo Jun 23, 5 53 11 PM

    It’s worked well, but it’s aging. It’s also somewhat slow compared to newer technologies, though that was (hopefully) a bonus, not a requirement.

    I then installed the new motherboard, which wasn’t too bad. The hardest part was getting the CPU cooler installed. Balancing the four arms and screwing things in while the large cooler wants to slide on thermal compound was a challenge. Fortunately I managed to get it secure without too much grease on my hands.

    I connected all my drives back, using some of the new SATA 3 cables that came with the motherboard. I didn’t bother connecting the front side speaker stuff since those connections are covered by the video cards. I added back both video cards and then plugged in basics: monitor, power, USB keyboard/mouse. I left some things uncovered, since I’ve rarely had things work perfectly on the first assembly.

    Photo Jun 23, 7 27 13 PM

    Crossing my fingers, I booted.

    Or didn’t. I got lights, which I haven’t always gotten. There’s a debug LED in there and I got a 99 code. Looking that up, I realized there’s a PCIe issue. There are only 3 slots, with 2 video cards, so I pulled one. Same issue.

    Pulled the second and it booted.

    I had made a bootable USB (borrowed from my son) and then added the W10 install iso. Things booted up and I installed Windows.

    Photo Jun 23, 7 31 21 PM

    I only had the onboard video, which worked, and I’m glad I had another machine since I needed to download the LAN drivers to connect to the network and video drivers to get beyond a basic 1024 resolution.

    Total time to get Windows back up, around 90 minutes, though most of that was wrestling with the CPU cooler.

    The next post will look at getting productive again, with newer hardware.

  • Selecting Speakers for the Summit

    This is a series of posts on the PASS Summit and SQL Saturdays. I’m outlining some thoughts here, sometimes for the first time, but on topics that I think make better events. These are opinions and thoughts, not mandates or demands.

    I attended, well, listened to, the PASS Speaker Selection Q&A this week. In the spirit of being constructive, I want to thank the board members and committee members for attending. I thought the event was well run and informative. I appreciate the disclosure.

    Tldr: I think the volunteers did a good job, with minor room for improvement. Disclose more numbers and guidelines, and involve the community more.

    Hearing about the process is always good as this affects the community that attends the event. Both speakers and attendees. I’ve been involved before, and should do so again, to see how things might be different. I appreciate the amount of work involved, and would like to thank Allen White, Lance Harra and Mindy Curnutt for their work. I know many others are involved, and thanks for your time as well.

    • 840 abstracts.
    • 255 speakers (3+/speaker)
    • 112 session slots (+10 pre-cons, 4 lightning talks)
    • 5000+ comments from reviewers.

    That last number is quite interesting. That’s an average of 5.9 comments per submissions, much higher than when I was involved. What’s more, Lance and Mindy reviewed all comments, ensuring none were inappropriate to return to speakers. While I abhor censorship, this is something that needs to be done. Some (very few) volunteers will poorly communicate their thoughts, or have a bad day. Reviewing and redacting (or asking for rewording) makes sense.

    There also was a note that Lancy/Mindy tracked the timing of comments to ensure volunteers spent time actually thinking about the sessions/speakers and not racing through with a quick CTRL+C, CTRL+V. That is impressive.

    I asked a question on first time speakers. Not to beat up the committee, but because I think the health of the community depends on regularly getting new speakers, both first timers at the Summit and new pre-con presenters. Note that I don’t want someone to give their first talk or their first pre-con at the Summit. They need to practice elsewhere, but we need a rotation of new speakers.

    Allen mentioned that he looked for 20-25% new speakers, though that guideline isn’t published or listed. I know that the number depends on the submissions, but having guidelines and then giving reasons for deviating is what I’d expect. Give numbers and then react. Adjust and explain why. That’s what many of us do with data and our jobs.

    For the record, I think 25% is high. Maybe 20%, especially as we have more and more speakers. I would like to see a goal of at least 10% each year. If you do more, fine, but explain a bit. Not a lot. A bit.

    Allen has a nice post with some numbers and the process explanation. Thanks, Allen.

    However.

    More Data

    I want to see more numbers. That’s our job. If PASS doesn’t have time, recruit a few volunteers. I’d bet there are a few people in the community that would love to play with data. Let us see the pre-cons broken out. Topics, resutls of surveys. There’s even this cool tool that lets you build some visualizations with data.

    Or better yet, put out a feed, or if that’s too hard, some numbers in an Excel sheet. A flat file. Let people do some analysis and learn. You might learn something as well.

    Honestly, while I think comments deserve some privacy protection, I’m not sure ratings do. I’d like to see those released. The committee is always going to upset people, and there will always be complaints. However, the more information you provide, the more we can comment, yes, also complain, but also you might learn something about how the community thinks about your choices.

    After all, you’re supposed to consider the community.

    I’m not asking you to only listen to the community. After all, the Summit is a business, and it’s fair to say that the 12th PowerBI session rated a 4.2 got bumped to get in a 3rd Extended Events talk rated 3.5.

    Disclose more and analyze more. React and adapt. If you don’t want complaints, resign. That’s part of the job.

    Enough on that.

    Community Vote

    I do think that it’s impossible to build a perfect schedule. Looking at last year’s numbers is inherently flawed. After all, how highly were the AlwaysEncrypted sessions rated last year? Or the first time speakers? It’s a guideline, and I’d like you to publish those numbers to show what you’re considering, but I also think the community deserves a vote.

    I asked the question and Allen responded that not a lot of people voted and there were issues. I dislike terms like “issues” without specifics.

    However, I’m not asking for sessions to bypass the program committee. I think there is good work done here. What I’m saying is that of the 112 sessions, when you get 100, put the last 10 or 12 up for a vote. Take the sessions rated 100-124 and drop them in a survey. Let community people, those that wish to, vote. After all, of your entire membership, how many vote for the Board? Probably a similar number to what you’d get here.

    You take popularity votes from last year’s numbers already. Take a few more.
    If it’s a lot of work, explain that. Maybe we can help you slim things down.

    Break the Bubble

    Mostly what I see from organizations, and what I’ve done, is that groups start to take on responsibility, feel the weight of that responsibility, and work in a bubble. Over time, they become more disconnected from the people they make decisions over.

    This is a hard process, and a lot of work. I know you try and mostly succeed. You may be overthinking this, and over-controlling it. Let go a little, take more feedback, and look to improve the process.

    Continually.

    That’s what we do in this business, or at least, what we should do.

  • Getting the Previous Row Value before SQL Server 2012

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

    I ran across a post where someone that was trying to access the previous value in a table for some criteria. This is a common issue, and  one that’s very easily solved in SQL Server 2012+ with the windowing functions.

    However, what about in SQL Server 2008 R2-?

    NOTE: I’m solving this quickly, the way many people do, but this is an inefficient solution. I’ll show that in another post. However, I’m showing how you can describe and solve a problem here. If you need to solve this, look for a temp table solution (or find a later post from me).

    Setup

    It’s pretty easy. Let’s get some data together. I’ll use a big sample since that’s easier to see the differences.

    CREATE TABLE MyID
    ( myid INT
    , myvalue INT
    );
    GO
    INSERT MyID
    VALUES (1, 10 ),
            (1, 20 ),
            (2, 400),
            (2, 500),
            (2, 600),
            (3, 8000),
            (3, 9000),
            (3, 10000),
            (3, 11000);

    Now, what I want is something that returns the previous row, assuming we’re ordering by the ID and value. If there is no previous value, let’s return a zero. Essentially what we want is something like this:

    select MyID        , MyValue       , MyPrevValue = ISNULL( x, 0)
    from …

    That’s the pseudocode. Obviously I need to fill in blanks. However, let’s build a test. Why? Well, I can then see my result data, and I can re-run the test over and over as I experiment with the query. It’s not hard, I promise.

    EXEC tsqlt.NewTestClass
      @ClassName = N'WindowTests';
      go
    CREATE PROCEDURE [WindowTests].[test check the previous row value for MyID]
    AS
    BEGIN
    -- assemble
    CREATE TABLE #expected (id INT, myvalue INT, PrevValue int) INSERT #expected
    VALUES (1, 10  , 0  ),
            (1, 20  , 10 ),
            (2, 400 , 20 ),
            (2, 500 , 400),
            (2, 600 , 500),
            (3, 8000 , 600),
            (3, 9000 , 8000),
            (3, 10000 , 9000),
            (3, 11000 , 10000) SELECT *
    INTO #actual
      FROM #expected AS e
      WHERE 1 = 0 -- act
    INSERT #actual
    EXEC dummyquery;
    -- assert
    EXEC tsqlt.AssertEqualsTable
      @Expected = N'#expected'
    , @Actual = N'#actual'
    , @FailMsg = N'Incorrect query' END

    If you examine the test, you’ll see that I create a table, insert the results I expect, and then call some procedure. I compare the results of the procedure with the table I built.

    That’s it. A simple test, but I’ll let the computer compare the result sets rather than trusting my eyes.

    Last thing, I’ll build my dummy procedure, which can look like this:

    CREATE PROCEDURE dummyquery
    -- alter procedure dummyquery
    AS
    BEGIN select MyID   , MyValue , PrevValue = MyValue from MyID
      END

    Now I have the outline of what I need. If I run the test now, I’ll get this:

    2016-06-07 10_18_23-Photos

    The test output tells me it has failed, the values in the #expected table (with a <), and the values from my query in the #actual table (with a >).

    Now I can debug and work on this.

    Solving the Problem

    First, I want to order the data and get a number that counts the order. The ROW_NUMBER function does this, which is available in SQL Server 2005+. I won’t go into SQL 2000- solutions because, well they’re more complex and there should be very few SQL 2000 instances left coming up with new problems.

    I can do this with this code:

    2016-06-07 10_21_40-Photos

    Note that I have a sequential counter that lets me order every row with an index. Now, I can access the previous row, since I know the MyKey value will be one less than the current row.

    With this in mind, let’s turn this into a CTE (removing the previous value). Outside of the CTE, I’m going to self-join the CTE to itself. I’ll use a LEFT JOIN since not every row will have a previous row. In fact, the first row won’t.

    The join condition, which you can play with, will be on the outer table’s ID being one less than the first table’s key. You could reverse the math as well, but that’s up to you.

    2016-06-07 10_29_37-Photos

    One last issue. Add an ISNULL to the previous value to return a 0 if there is no match. Now, let’s run the test.

    2016-06-07 10_31_58-Photos

    SQLNewBlogger

    This was a slightly longer post, where I tried to explain how I setup the problem and solved it. I included a test, which didn’t add much coding time. In fact, the writing took far longer than the coding itself.

    This is the type of problem I’d encourage you to solve on your blog. If you want to repeat this, look for a solution with temp tables, as the CTE incurs a lot of reads. This isn’t really what you’d like to do in production code.

  • Not a Great Search

    Tldr: A bit of a rant. I’m not spending a bunch of time crafting this.

    I have mixed feelings about searching for information on Microsoft sites. It kind of works, kind of doesn’t. I know that there are resource constraints to upgrading their sites, but I’m more and more annoyed.

    Perhaps this is one reason I don’t use Bing. Maybe, not sure. I need to think about this.

    Anyway, I go to the main BOL page online often. It’s supposed to be more updated than the local help, and I don’t have to use some procedure to get to it. I went today and entered in a search, getting these results.

    2016-06-22 13_47_36-t-sql wildcard characters - MSDN Search

    Check out the second one. That might be interesting, and it’s in the Support KB. I click on it and see this:

    2016-06-22 13_53_40-How to use wildcard characters in the SQL-SELECT statement in Visual FoxPro

    That. Is. Not. What. I. Want. (at least not these days)

    Even surfacing the entire title, or maybe tagging this as a VFP article in addition to a kb one.

    As I delve into more technologies, I find acronyms crossing over, so I want to look for a term in SQL Server, or in C#, and right now I have to search and then try to limit things with a click on the left. Except that I don’t always get a good way to limit searches.

    2016-06-22 13_55_37-Settings

    That’s not a great example, but that’s the term of I thought of today that crosses over.

    Can we please get some way to default a search to the areas we’re working in? I can click something if I’m working with SQL and need to search wider, but I seem to get (more and more) results from Sharepoint, C#, etc that aren’t relevant.

    Ugh, I know I’m ranting a bit, but search becomes more and more important in the see of data, especially with things like Azure rev’ing every quarter. Give me a way to search current docs, in my area, easily, by default.