This is about me and my quest for, er... greater things in life? Good food, good drinks, friends and family and my eternal quest to figure out what I want to do when I grow up. (hint: it's probably going to involve code)

Tuesday, December 16, 2008

SQL code can smell too

I just wrote some bad SQL code tonight that I think I'll have to revisit tomorrow morning when I get back to work.

I think that using a stored procedure to populate an Insert statement is simply wrong. Should anyone modify that stored procedure or change the order in which the values are returned, my insert will fail. Can you smell that? Yeah, it smells bad.

I was simply trying to "encapsulate" things a little and make my code less cluttered. Maybe using a common table expression or temporary table would be a much better idea.

0 comments: