Sunday, October 11, 2009

SQL Saturday #25 and an Epiphany









I went to SQL Saturday #25 (we’ll shorten it to the Twitter hash #sqlsat25 for the rest of this post to save typing, ok?) this weekend, and I can’t come up with enough superlatives to describe the experience! Engaging, exhilarating, interesting just don’t do it justice. Obviously I enjoyed myself :)

The scariest thing I learned was that I have been wrong. I was talking with someone at work the other day, and told her I was going to #sqlsat25 because I felt I had learned just enough SQL Server stuff in the past two years of self learning to know how much there is to learn. I was dead wrong. I know *nothing* compared to the likes of the speakers present! Wow, it was a great experience!

The event itself was held in Oakwood, Georgia (which is right next to Gainesville, GA, where the event was advertised as happening, which itself is about a 45 minute drive northeast of Atlanta. As I live about three hours south-southwest of Atlanta, this was about a four hour drive, all told, one way. To make matters more fun, I am in Central Time, they in Eastern, so I had to account for that when I woke up at 2:30 AM to get on the road by 3 my time to get there in time for registration, 8 AM their time. Try to figure all that out at three in the morning :)

I got there, though, no problems on the way there or back, and I got to registration with ten minutes to spare, in time to register and enjoy some coffee and donuts before sessions started. Speaking of which, I can only really talk about the sessions I was in, but I heard all the others were great. By the way, I know my pictures are bad – all I had with me was my Blackberry, and I didn’t want to disrupt things taking too many pictures, so I have what I have.

My first session was with Audrey Hammonds (LinkedIn) – The T-SQL Trifecta: Enhancements for Everyone.


Audrey, an extremely smart and knowledgeable lady, discussed Merge, Try... Catch, and Multi-Row Inserts. This was a clearly done, really professional and enlightening presentation. Audrey built a database to demonstrate that had different rock bands and their members as data, to show how updating them (like when Van Halen replaced David Lee Roth with Sammy Hagar [Rollback Transaction, please!]) could be done with Multi-Row Inserts, then went on to manipulate the data in other ways with Merge, and showed how to do error handling utilizing Try… Catch. I had never used Merge, or Multi-Row Inserts, and had never even known Try… Catch was available in T-SQL, so I really got some takeaway from this one, meaning when I go back to work Monday I will be re-writing code :)

Next up was with new speaker Neal Waterstreet – SQL Server Backups.



I found out later that this was only Neal’s second speaking presentation, so the following should be taken in context. I was disappointed with this session. Everything Neal said during the presentation was just word for word reading from the slides, and he never once looked up from the laptop screen he was reading to acknowledge anyone was in the room with him. The content was basic, which I guess was the point, but it was mainly, there is this type of backup, there is that type of backup, etc. No examples, demos, code (which I guess there wouldn’t be much for the subject), and he stopped suddenly and asked if there were any questions after 25 minutes in an hour session. Kudos to Trevor Barkhouse, another speaker in the audience, for bringing up points and driving the discussion for the rest of the session. Neal, if you’re reading this, I’m sorry to be brutally honest, but that’s who I am.

I then went to Julie Smith’s session – Cool Tricks to Pull from your SSIS Hat.


Julie must know Audrey, as she was in the audience during Audrey’s session, and their banter seemed to be like they were friends, but Julie is someone else. Funny wouldn’t be the right word. Playful would be closer. Also very smart, also really knows her stuff. I don’t deal much in SSIS besides a couple of tries in BIDS, as my server is 2005 Workgroup, which doesn’t include SSIS, but she made it seem easy! There was great audience participation, and she took it all in stride, even when someone suggested she do something another way, and when she tried she kept messing up a variable name, everybody had a good laugh, most of all Julie. Oh and extra points for the inclusion on her “Gotcha’s” slides the Monty Python Rabbit of Caerbannog, aka the Vorpal Bunny!

After Julie’s session was lunchtime, Southern fare including Pulled Pork and BBQ Chicken, beans and Mac & Cheese, with a good amount of time for Networking. This is something I am bad at, and hope to get better. I am not in the same league with these people and so I feel I don’t have much to add to a conversation, but I did get to sit with Robert Cain (!) for a while at lunch, and hear his thoughts on a few things while talking with the folks at our table.

After I ate, I went into the lecture hall to wait for the next session with Stuart Ainsworth (Blog | Twitter)– The Social DBA. The before the session session was as much fun as the session itself! Stuart had YouTube up on the screen, played the Code Monkey video for us, the Wedding Dance, etc., all the while bantering with the folks in the room while waiting for time to start. FUN!


The session itself consisted of being, or becoming, a Social DBA, discussing things like Twitter and blogging, what sites to find people and information, how to get into the spirit of community within the profession. Really enjoyable, and the hour was too short, there is so much to the subject. The whole idea is what brought me to #sqlsat25 in the first place, as I have started the Twitter and Blog thing just this past year, and it’s how I heard of the conference.

After the rollicking good time with Stuart, I next went to see Robert Cain (Blog | Twitter) presenting on SQL Server Full Text Searching.


This is another subject that had interested me, as I am currently trying to work through this subject. Robert is, to put it bluntly, an Expert. The capital is not a typo! He’s a SQL Server MVP, super professional, and, as I said, I had lunch with him, so I can say firsthand that he’s a nice guy. His presentation was full of clear explanations, useful code demos, and he told us up front everything in his pres was already on his site. Did I say Professional? Did I say Expert? This session was great!

There was a quick afternoon break, then it was All Speakers - Open Discussion! This was supposed to be Development/BI breakout, but the DBA breakout had only about ten people in it, so Stu came in and asked if they could join in, so it was a free-for-all! Great discussions about Cloud Computing, Agile Development vs. Waterfall and SCRUM (these are terms I have never encountered, so I am Googling after posting this), Microsoft Security Essentials came up, along with Visual Studio Data Dude, also things I need to look up. As I said, I know *NOTHING!*


Finally there was the session, Closing Remarks and Giveaway. At every session, we were given Feedback Cards, and, in exchange for filling them out, we got back coupons for a drawing, and this was the drawing. There was a tremendous pile of Swag! Great books, ebooks, t-shirts, all kinds of cool things! After thanking the speakers, and telling us about the after party (which, sadly, I couldn’t attend) they started calling out numbers for people to win prizes. So many people walked out with new books – even I, who never win anything, walked out with a copy of A Developer’s Guide to Data Modeling for SQL Server! Stu’s daughter called the numbers, and she was great, a fun kid to have around.

She was also a volunteer at the event, and I can’t leave this post without saying a big Thank You to all the volunteers! They introduced each speaker, made sure feedback cards and coupons were given out, took care of the food, gave directions, all were tremendously helpful – Thanks All!

In the end, though, as I tweeted on the way out, “All things must come to an end, and so has #sqlsat25. A good time was had by all.”

Thoughts on the way home

I had, as intimated above, a long trip both there and back again, and a lot of time to reflect on the day. (Cue Deep Thoughts background graphics :) I also was listening to an audio book on the trip, and something came up in that that jibed with my thinking enough I had to stop the CD and take a Voice Note Recording, so I wouldn’t lose the thought.

I think I know why SQL Server is such an engaging platform! The part of the audio book that jarred me was talking about left brain and right brain functional hierarchies, and that sparked a thought about SQL Server. Left Brain – Right Brain, SQL Server encompasses both. Left Brain is analytical, so is SQL Server, Right Brain is creative, so are some of the things done with SQL. Left Brain is sequential, see the connection? Right Brain simultaneous – set based, are we getting it yet? There’s probably more, but I am no philosopher. It just seems to me that SQL Server encompasses our full brain, makes us use both halves for us to develop for it and administer it. Maybe that’s why the SQL Server Community is such a great group of people, so engaging, every one of them smart as a whip! They’re not right-brained or left-brained people, they are both sides brained people, people who use their intellect, their humor, their creativity, their passion, people who have found common ground in a software platform.

I tweeted one more thing before I went to bed Saturday night. “20 hours awake, 422 miles driven, it's been a long, exhausting, interesting, gratifying day based around #sqlsat25. When's the next one? :)”

Wednesday, October 7, 2009

Trends for Life

In the manufacturing world in which I live, we worry about things like First Pass Yield (FPY), something I will show how I calculate in T-SQL in a future post. In general, if you don’t know, FPY is the percentage of widget that makes it through the manufacturing process the first time, without rework or retest. I work in electronics manufacturing, so rework can, and has been, a big deal, resulting in low FPY.

While building an SSRS report that included daily FPY results, and I wanted to put some indicator of a trend, so the daily result would have some context – are we doing better or worse than we have been. So I wrote a stored procedure to determine trend, a very simplistic thing from some information I found online about how to calculate trends.

The formula I used involved some higher math that I don’t truly understand, but was finally able to convert to T-SQL to the point where it looked like this:

select
((@n * sum(x*y)) - (sum(x)*sum(y)))/
((@n * sum(Power(x,2)))-Power(sum(x),2)) as r
from @sample

Here, @n is the count of the rows in the table variable @sample, x is the week number, and y is the FPY average for that week. I did a select on our FPY data to gather the average FPY per week for 12 weeks, but the example given below will only cover five, for simplicity’s sake.

So, to wit:

/***************************************
Determine trend direction for FPY samples
***************************************/

DECLARE @Sample TABLE (x FLOAT, y FLOAT)
DECLARE @n int

-- some sample data
INSERT @Sample
Select x=1, y=.98
UNION ALL
Select x=2, y=.96
UNION ALL
Select x=3, y=.88
UNION ALL
Select x=4, y=.81
UNION ALL
Select x=5, y=.76

select @n=count(*) from @sample --this is just for convenience, you can substitute count(*) for @n in the code
select -- the big formula
((@n * sum(x*y)) - (sum(x)*sum(y)))/
((@n * sum(Power(x,2)))-Power(Sum(x),2)) AS r
from @sample

Utilizing the given data, the result ® works out to -.059, which should be the slope value of a trend line, and it makes sense, as the numbers are obviously going down. (In the below graphs, the data is the thick green line, the trend the thin black line.)

If the numbers are reversed like so:
INSERT @Sample
Select x=1, y=.76
UNION ALL
Select x=2, y=.81
UNION ALL
Select x=3, y=.88
UNION ALL
Select x=4, y=.96
UNION ALL
Select x=5, y=.98

The result works out to .059, an upward trend, again obvious from the numbers given.

A more random order, like so:
INSERT @Sample
Select x=1, y=.76
UNION ALL
Select x=2, y=.88
UNION ALL
Select x=3, y=.96
UNION ALL
Select x=4, y=.81
UNION ALL
Select x=5, y=.98

Gives a result of .037, a smaller upward trend, but still positive, still upward.

From this code, then, I could formulate my reports to place either an upward pointing or downward pointing arrow next to my bar chart (for each manufacturing area) in my report, based on the positive or negative value of the trend for the time period, and the group of managers could see at a glance both what yesterday’s FPY was from the bars on the chart, and which way each manufacturing area was trending.
By the way, if there’s a better way of doing this, please let me know, I am tring to give back to the community that has taught me so much, but I am more than happy to learn more from that self same community, thank you so much.

Tuesday, October 6, 2009

TwitterFeed test

Just testing to make sure my new twitterfeed works, move along now, nothing to see here...

Promotion, and Thanks

Thanks largely to the ever so helpful SQL Server Community, I have been promoted from Quality Tech to Quality Systems Analyst!

I have spent the last two years learning SQL Server mostly from SQL blogs and forum posts, and the work I have been able to produce has helped our business, who in turn rewarded me with a promotion. I am pleased as punch to get it, and look forward to the work I will be able to do to further our efficiency and cost reduction through the presentation and use of our manufacturing data. (I've got the business speak down!)

Mainly, though, I want to thank the SQL server community somehow, and the best way I know how to do that is to give back to that community. Somehow. Over the next weeks and months, I will focus my blog more on helping as I can, and try to come up with other ways to give back, and to help other 'Accidental DBA's'

Meanwhile, I'm just stoked that all the time spent squinting at the screen has paid off! Thanks to everybody that helped make it possible!