Monday, 12 May 2008

Tip: Using SQL Server 2005 Stored Procedure to return the Top N records

I had a problem today where I tried to make a stored procedure to return the top N records from a table, where N was a parameter input to the stored procedure.
Apparently you can't say 'SELECT TOP @N..." where @N is the parameter.
A quick search led me to this article by 4GuysFromRolla which re-introduced me to the ROWCOUNT statement and showed how to use it most effectively in this case by saying 'SET ROWCOUNT @N" and then calling my SELECT statement to achieve the same effect.

The initial alternative a friend recommended was to dynamically build the SQL statement using @N as a parameter in the string being built and then calling EXEC on it, however dynamic SQL is something I was taught to stay away from unless absolutely necessary. This is because by its nature dynamically generated SQL would not have benefitted from SQL Server's built in query optimizer when the stored procedure's code was compiled and thus would run slower than fully declared SQL statements and stored procedures every single time it was called.

Saturday, 3 May 2008

On Lisa's Leaving

Lisa De Coteau is one of the most famous and well loved folks in Teleios. One of the core team members there, Lisa's been in it since the early days of the company when the offices were non-existent and coding happened in the house of one of the founders. Lisa left the company this week, her new husband anxiously awaiting her return to Washington D.C. for them to start their new life together. We at Teleios were each asked to give one word to describe Lisa, and having known her impact on me in the short time I knew her, and her impact on Teleios on the whole, I had to say my word for her, "inspiring," was justified in every sense. Here's my short plug on why.

I am not much for having heroes. Real-life heroes are, after all, only human. They can, and often will, fail one's rigorous vision of super-human perfection with one very human mistake. I do believe however, that there are people out there who through their very nature and cognisant effort to be the best they can be and to bring others with them for the ride, become great. If one is lucky, one builds a relationship with that person to the point where they become a mentor to oneself in one's own path to being a great person. That is Lisa in a nutshell. A great person who inspires others to be great people themselves. I have not been at Teleios long enough to have reached the mentor/mentee relationship with her, but I have been there long enough to see what great people those she has mentored are on the way to becoming.

From the history I've gathered, Lisa came to Teleios when it was very new as a company, and instilled in the initial founders an energy of passion and a drive to acheive a sustainable work culture that persists to this day. Without knowing it, (or deliberately knowing it, I never got to ask her), Lisa brought the core culture into Teleios and stuck to a major rule of Jim Collin's Built To Last as the company grew: ("Preserve the core, Stimulate Progress") by pushing the founders to understand, accept, and integrate a "well-balanced employee" concept where all managers gained an appreciation for time needed for personal lives of employees in addition to the time demanded for work.

Given enough time and research to prove the idea right I would venture to say that Lisa ensured that Teleios was "built to last" by promoting many of the core ideas of the well known book before the book was even written and the ideas articulated so clearly. Her driven yet unassuming nature, her willingness to sacrifice, to grow and to learn from feedback of others, to introspect honestly to improve herself and to inspire others along the way to strive to reach their fullest potential would have me thinking she also demonstrated a shining example of "Level 5 leadership", which according to Jim Collin's second book, "Good to Great" is a necessary component for any company to make the leap from good to great.

In honesty, Teleios has lost a valuable teammate, mentor and friend with Lisa's move, but as a true Level 5 leader she has ensured that despite her absence the culture and values she promoted and enshrined in the institution that is Teleios continue to live on. My fondest best wishes to you Lisa, may you in your new life inspire in Washington at least as many people as you have in little old Trinidad. Au revoir!

Thursday, 1 May 2008

Today is RSS Awareness Day

RSS Awareness Day

No, really it's true...Check out the RSS day homepage for more info on RSS, what it is, and how it can make your Internet experience a whole lot more fun.

I was made aware of this by the article on the Common Crafts blog who was pointed to it by DailyBlogTips.

To celebrate I've also integrated the "RSS in Plain English" video created by the Common Crafts folks and also available on their website.