Tuesday, April 25, 2006

Deadline!

To-day we are slightly stressed over an impending deadline, so we'd like to express our feelings through the poetic use of a cursor* with accompanying variables. Feel free to sing along.


/* La la la la la! */
DECLARE @Sleep int
DECLARE @Sanity varchar(10)
DECLARE @Swear_word varchar(20)
SET @Sleep = NULL
SET @Sanity = 'Absent'

DECLARE Up_Shit_Creek_Cursor CURSOR FOR

/* Crap!!! */
SELECT curse_word
FROM profanity
WHERE profanity.language = 'English' AND profanity.curse_word NOT IN ('golly!', 'darn!', 'shucks!', 'gee whiz!')

OPEN Up_Shit_Creek_Cursor
FETCH NEXT FROM Up_Shit_Creek_Cursor INTO @Swear_word
WHILE @@FETCH_STATUS = 0

/* (sobbing) */
BEGIN
SELECT @Swear_word + '!!!!!!!!!!!!!!!!!!!!!!!!!'
FETCH NEXT FROM Up_Shit_Creek_Cursor INTO @Swear_word
END

CLOSE Up_Shit_Creek_Cursor
DEALLOCATE Up_Shit_Creek_Cursor
/* Good night */

* For heaven's sake, don't ever actually use a cursor! They're very, very, very, very, very bad! You can write a WHILE loop, a CASE statement, use derived or temporary tables, or even perform multiple query statements instead. It won't kill you!

0 Comments:

Post a Comment

<< Home