Not that I get to watch it much with a 13 y.o. in the house but one of my favorite shows has to be "Penn & Teller: Bulls*#t" Basically they spend the entire show debunking some pseudo science quackery of one form or another and it's hilarious. My wife hates the language they use, and obviously I'm not allowed to let E watch it with me. If it weren't for Penn's language and the random naked women (that's always been a P&T thing), I'd love to have him watch it. Skepticism is good, especially in teenage minds before they're filled with so much random crap. Anyway, this is all a lead up to one of my favorite quotes from Penn Jillette. After the break because it's quite a bit of swearing, but with a purpose:
Thursday, August 19, 2010
SQL fun
You ever have one of those days? This one stretched out for about a week. Over and over again, trying to solve a very odd problem. Seems like a certain type of look up was failing, but only on a single database. Check the stored procedure for look up, looked fine. Replicated the process to populate the look up, worked fine, for a moment, then suddenly didn't work anymore. WTH?!?
Here's my script to add a value to the table. Keep in mind that I didn't have direct access to the table itself, I'd assumed the look up query was failing, and ran repeated tests against that. Anyway, to add a value to the table:
delete from lookUpTable where AccountID = @AccountID or @LookupID = @LookupID
insert into lookUpTable (AccountID, LookupID) values (@AccountID, @LookupID)
I looked over this query (quickly, mind you, I was still convinced the look up itself was failing). Then I asked to look at the table. If you read the above query and said, "You found only one row, right?" cookie for you, if not, look at the above script one more time. The first time someone who wasn't me looked at it they pointed out the problem immediately, but it was kicking me around for what felt like forever. Always good to have another pair of eyes.
In my defense this stored procedure had been changed several times, I'd look at it and go "yep, looks right" and examine the look up s.p. again for issues. And lookUpTable was being cleared over and over again while we tested.
Here's my script to add a value to the table. Keep in mind that I didn't have direct access to the table itself, I'd assumed the look up query was failing, and ran repeated tests against that. Anyway, to add a value to the table:
delete from lookUpTable where AccountID = @AccountID or @LookupID = @LookupID
insert into lookUpTable (AccountID, LookupID) values (@AccountID, @LookupID)
I looked over this query (quickly, mind you, I was still convinced the look up itself was failing). Then I asked to look at the table. If you read the above query and said, "You found only one row, right?" cookie for you, if not, look at the above script one more time. The first time someone who wasn't me looked at it they pointed out the problem immediately, but it was kicking me around for what felt like forever. Always good to have another pair of eyes.
In my defense this stored procedure had been changed several times, I'd look at it and go "yep, looks right" and examine the look up s.p. again for issues. And lookUpTable was being cleared over and over again while we tested.
Subscribe to:
Posts (Atom)