Sunday, January 10, 2010

Moving SQL posts to Wordpress

As some of you may have noticed already, I am moving my SQL related blogs to a Wordpress blog. The new URL for that is

I will be keeping this blog open, and transitioning it back to a more personal updates kind of blog (like if you scroll through, you'll see the saga of the housepainting a few months back, which will keep going when things warm up :)

Thanks for following me, and if you're SQL minded, please check out my newest blog!

Monday, November 30, 2009

How do -You- use SQL Server

Over the Thanksgiving weekend, I had the great pleasure of meeting Jorge Segerra (Blog | Twitter), @SQLChicken on Twitter. We got together for an hour or so at a Starbuck’s in Tampa, talking about all kinds of things, SQL and otherwise. The conversation got around to SQL Saturday coming up in Tampa, and Jorge invited me to present, to which I replied, “What would I talk about?” Eventually we got it down to I should discuss how I use SQL Server at work. I find I have a sort of unique type of work environment with SQL Server. I told Jorge that I wondered what other people do with the product, and he suggested I ask the question in my blog, so here we are.

In the spirit of the chain of posts that asked folks how they got started in SQL Server, I would like to tag a few folks and ask the question… What do you do with SQL Server in your work? I know in general terms, people do dev or admin, backups, restores, or some combination of those, but I’m curious about a little more detail.

For instance, what goes on in my place of work is, in a few words, like this. We are a marine electronics manufacturing facility – we make fishfinders and related accessories. Originally, we got SQL Server 2005 Workgroup Edition as part of a package that laser engraves barcodes on printed circuit boards, serializing them so we have traceability through the manufacturing process. The board serial becomes the fishfinder unit’s serial number that the end user uses to register his unit with us after he buys it, and for software upgrades, etc.

During the manufacturing process, I can grab the data gathered at various electronic test points, by way of the test software sending test data to SQL Server as the tests are completed. With this data, I can get manufacturing rates and yields, which get reported both in realtime in the form of charts displayed on a projection screen on the production floor, and in reports that management reviews every other day. Both the charts and reports are excel files, in which I use Microsoft Query to communicate with SQL Stored procedures to retrieve the data, and then use Excel tools to display it, sort it, do what-if scenarios, charts, etc.

We are owned by a parent company, which uses J.D. Edwards World Enterprise database (which is running on top of a SQL Server 2000 instance) to run the business, and we have been having our parent company send some of the enterprise data to our SQL Server, such as work orders, part number lists, etc, which I join in with the tables on our local SQL box to be able to combine data for reports. We are in the beginning stages of sending data the other way, into JDE, to automate completions to close work orders, etc.

Also, lately, we have been using our employee time management company send hours, which are collected automatically from digital time clocks on the network, through a secure FTP connection, which I also copy into tables on SQL, joining them with the rates and yields collected, to be able to then report on Labor Efficiency.

All of the above I plan to break down into a coherent set of slide decks, to present at a SQL Saturday, the details of how these things get in and get out, the T-SQL code I’ve written, etc. For right now, though, as I said in the beginning, I’m curious as to what, in general but more detail then “I’m a DBA” you do in your workplace. How do you use SQL Server, what kinds of uses have you found for it, what in your environment benefits from it, etc?

I’ve been, as some of you know, trying to learn SQL Server, and this is part of my journey of knowledge. Knowing how other people use the product, what goes on in the industry, these are things of which I have no knowledge, and would like to.

To start the round-robin off, I would like to specifically tag Jorge Segarra (you knew that one was coming didn’t you?) and also Denny Cherry (Blog | Twitter) and Grant Fritchey (Blog | Twitter), just because they’re such interesting folks :) Personally, because I’m from New England, I’d also like to hear from Adam Machanic (Blog | Twitter), and Mike Walsh (Blog | Twitter).

Sunday, November 22, 2009


Technically I haven't been AFK, just trying to keep up with the torrent of work, blogs, tweets, woodworking, household stuff, family stuff, medical condition, work, etc., etc. None of it excuses, but hey, I'm using them all, so they all add up to one big excuse!

So what's been going on? Well, let’s go through the various views of life, you’ll get an idea why I haven’t blogged anything recently for lack of time, gumption, wherewithal, whatever. :)

A few weeks ago, my daughter announced that she and her boyfriend got engaged to be married, and was moving out. That was on a Tuesday evening. On Wednesday afternoon next, she apparently decided there was nothing to be gained by waiting, so she and her fiancĂ© went to the town hall and got married. There you have it, in one fell swoop I lost my daughter and gained a son-in-law. That’s big stuff, and took quite the while to get used to.

If having my twenty year old daughter get married wasn’t proof enough, I’ve also self-proven I’m getting on in years, as my progressive bifocals came in this week, and I’m spending time trying to learn to get used to these. Last time I was at the eye doctor, four years ago, my vision had finally gotten down to 20/20. Now, I find I have astigmatism in my left eye, and macular degeneration in my right, along with my diabetes creating multiple micro-aneurisms in my eyes. Woof.

At work, among other things, I've written an application (in Excel, of all things) for the Quality Department to use in completing audits, so anyone of us can take a tablet notebook out on the production floor, check off red, yellow and green radio buttons for each category of procedure we're auditing, then hit the big Submit button and the app then creates an email, saves the report sheet, reports the result score in a yearly tracking sheet all automatically. This should save, over the course of a fiscal year, at least a couple dozen hours of time for all five of us doing audits.

In my community volunteering, I am a member of the local Men’s singing group, and we have been getting ready for the annual town Christmas concert, what they call around here the “traditional start of the holiday season in Eufaula.” That takes up a good bit of time, but it’s a really enjoyable endeavor, so there. My parents will be coming in that weekend, too, so maybe we can take in the Annual Christmas Tour of Homes, at some of the local manses, all decked out for the holidays. Should be a fun weekend.

On the woodworking front, I have gotten back into the shop after a weeks long hiatus, completing the second fluted pilaster of the bureau in potentia that I have been building for the past couple of years. Good things take time :) I will post pictures soon, promise.

In SQL Server news, I have been asked by Blythe Morrow (Twitter | LinkedIn), Community Programs Coordinator at Professional Association for SQL Server (PASS) to be the next leader for PASS’s Application Development Virtual Chapter, taking over for Jeremiah Peschka (Twitter | LinkedIn | Blog), who is moving on to PASS’s Board of Directors. Those are some HUGE shoes to fill, Jeremiah is a Microsoft MVP, blogger extrodinaire, and all around expert, and I am going to pale in comparison. Like I told Blythe in a tweet, though, I love a challenge. We are targeting January for that to come about.

So, yeah, I’ve been busy. I should probably say that I am also getting together what it takes to move my blog over to Wordpress, under my own URL, which, if I can get my hosting service to answer an email or call, will happen soon. I need to get blogging up to par to be able to better serve the SQL Community, especially as I am going to be a much more visible contributor in other fronts.

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:

((@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 @n int

-- some sample data
INSERT @Sample
Select x=1, y=.98
Select x=2, y=.96
Select x=3, y=.88
Select x=4, y=.81
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
Select x=2, y=.81
Select x=3, y=.88
Select x=4, y=.96
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
Select x=2, y=.88
Select x=3, y=.96
Select x=4, y=.81
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!