I work for one of the larger insurance companies in the US. My sub company deals mainly with behavioral health issues. Yesterday I got presented with an interesting issue. Years ago a young kid built quite an interesting report system. I really had not touched it before although I know other developers who have. Its a continual cluster of WTFs, to say the least. This app, we shall call it App X, is used to print out various reports. Anyways several reports were printing out erroneous data, totaling things wrong etc. These reports can and do contain 100+ fields and are generated by a stored procedure. When I went to take a look at the stored procedure I was quite amazed. It was the most god-awful thing I'd seen in a long time. 1500+ lines. Finding an error in it was going to be a nightmare. Luckily the kid who wrote it was recently rehired by the company. so I walked over and asked him what the deal was with this stored procedure. Turns out years back he had written a stored procedure to create this 1500+ line stored procedure. I think the attachment speaks for itself.

select State,5 as Age_Index,sum(TotalEncounter) AS SumOfTotalEncounter,sum(Male) AS SumOfMale,sum(Female) AS SumOfFemale,sum(Unknown) AS SumOfUnknown,sum(HL) AS SumOfHL,sum(DMH) AS SumOfDMH,sum(DYS) AS SumOfDYS,sum(DMR) AS SumOfDMR,sum(DSS) AS SumOfDSS,sum(F1) AS SumOfF1,sum(F2) AS SumOfF2,sum(F3) AS SumOfF3,sum(F4) AS SumOfF4,sum(F5) AS SumOfF5,sum(F6) AS SumOfF6,sum(F7) AS SumOfF7,sum(F8) AS SumOfF8,sum(F9) AS SumOfF9,sum(F10) AS SumOfF10,sum(F11) AS SumOfF11,sum(F12) AS SumOfF12,sum(F13) AS SumOfF13,sum(F14) AS SumOfF14,sum(M0) AS SumOfM0,sum(M1) AS SumOfM1,sum(M2) AS SumOfM2,sum(M3) AS SumOfM3,sum(E0) AS SumOfE0,sum(E1) AS SumOfE1,sum(E2) AS SumOfE2,sum(E3) AS SumOfE3,sum(E4) AS SumOfE4,sum(E5) AS SumOfE5,sum(E6) AS SumOfE6,sum(E7) AS SumOfE7,sum(E8) AS SumOfE8,sum(E9) AS SumOfE9,sum(E10) AS SumOfE10,sum(E11) AS SumOfE11,sum(E12) AS SumOfE12,sum(E13) AS SumOfE13,sum(EL0) AS SumOfEL0,sum(EL1) AS SumOfEL1,sum(EL2) AS SumOfEL2,sum(EL3) AS SumOfEL3,sum(EL4) AS SumOfEL4,sum(EL5) AS SumOfEL5,sum(EL6) AS SumOfEL6,sum(EL7) AS SumOfEL7,sum(EL8) AS SumOfEL8,sum(EL9) AS SumOfEL9,sum(EL10) AS SumOfEL10,sum(EL11) AS SumOfEL11,sum(EL12) AS SumOfEL12, ---------------sum(Dx0) AS SumOfDx0,sum(Dx1) AS SumOfDx1,sum(Dx2) AS SumOfDx2,sum(Dx3) AS SumOfDx3,sum(DS0) AS SumOfDS0,sum(DS1) AS SumOfDS1,sum(DS2) AS SumOfDS2,sum(DS3) AS SumOfDS3,sum(DS4) AS SumOfDS4,sum(DS5) AS SumOfDS5,sum(DS6) AS SumOfDS6,sum(DS7) AS SumOfDS7,sum(DS8) AS SumOfDS8,sum(DS9) AS SumOfDS9,sum(DS10) AS SumOfDS10,sum(DS11) AS SumOfDS11,sum(DS12) AS SumOfDS12,sum(DS13) AS SumOfDS13,sum(DS14) AS SumOfDS14,sum(DS15) AS SumOfDS15,sum(DS16) AS SumOfDS16,sum(DS17) AS SumOfDS17,sum(DS18) AS SumOfDS18,sum(DS19) AS SumOfDS19,sum(DS20) AS SumOfDS20,sum(DS21) AS SumOfDS21,sum(DS22) AS SumOfDS22,sum(DS23) AS SumOfDS23,sum(DS24) AS SumOfDS24,sum(DS25) AS SumOfDS25,sum(DS26) AS SumOfDS26,sum(DS27) AS SumOfDS27,sum(DS28) AS SumOfDS28 ----------------into #tbltotalFROM #tblcount group by State

--INSERT TOTAL RECORDS THAT HAVE AGE_INDEX 5 INSERT INTO #tblcount select * from #tbltotal

I work for one of the larger insurance companies in the US. My sub company deals mainly with behavioral health issues. Yesterday I got presented with an interesting issue. Years ago a young kid built quite an interesting report system. I really had not touched it before although I know other developers who have. Its a continual cluster of WTFs, to say the least. This app, we shall call it App X, is used to print out various reports. Anyways several reports were printing out erroneous data, totaling things wrong etc. These reports can and do contain 100+ fields and are generated by a stored procedure. When I went to take a look at the stored procedure I was quite amazed. It was the most god-awful thing I'd seen in a long time. 1500+ lines. Finding an error in it was going to be a nightmare. Luckily the kid who wrote it was recently rehired by the company. so I walked over and asked him what the deal was with this stored procedure. Turns out years back he had written a stored procedure to create this 1500+ line stored procedure. I think the attachment speaks for itself.

select State,5 as Age_Index,sum(TotalEncounter) AS SumOfTotalEncounter,sum(Male) AS SumOfMale,sum(Female) AS SumOfFemale,sum(Unknown) AS SumOfUnknown,sum(HL) AS SumOfHL,sum(DMH) AS SumOfDMH,sum(DYS) AS SumOfDYS,sum(DMR) AS SumOfDMR,sum(DSS) AS SumOfDSS,sum(F1) AS SumOfF1,sum(F2) AS SumOfF2,sum(F3) AS SumOfF3,sum(F4) AS SumOfF4,sum(F5) AS SumOfF5,sum(F6) AS SumOfF6,sum(F7) AS SumOfF7,sum(F8) AS SumOfF8,sum(F9) AS SumOfF9,sum(F10) AS SumOfF10,sum(F11) AS SumOfF11,sum(F12) AS SumOfF12,sum(F13) AS SumOfF13,sum(F14) AS SumOfF14,sum(M0) AS SumOfM0,sum(M1) AS SumOfM1,sum(M2) AS SumOfM2,sum(M3) AS SumOfM3,sum(E0) AS SumOfE0,sum(E1) AS SumOfE1,sum(E2) AS SumOfE2,sum(E3) AS SumOfE3,sum(E4) AS SumOfE4,sum(E5) AS SumOfE5,sum(E6) AS SumOfE6,sum(E7) AS SumOfE7,sum(E8) AS SumOfE8,sum(E9) AS SumOfE9,sum(E10) AS SumOfE10,sum(E11) AS SumOfE11,sum(E12) AS SumOfE12,sum(E13) AS SumOfE13,sum(EL0) AS SumOfEL0,sum(EL1) AS SumOfEL1,sum(EL2) AS SumOfEL2,sum(EL3) AS SumOfEL3,sum(EL4) AS SumOfEL4,sum(EL5) AS SumOfEL5,sum(EL6) AS SumOfEL6,sum(EL7) AS SumOfEL7,sum(EL8) AS SumOfEL8,sum(EL9) AS SumOfEL9,sum(EL10) AS SumOfEL10,sum(EL11) AS SumOfEL11,sum(EL12) AS SumOfEL12, ---------------sum(Dx0) AS SumOfDx0,sum(Dx1) AS SumOfDx1,sum(Dx2) AS SumOfDx2,sum(Dx3) AS SumOfDx3,sum(DS0) AS SumOfDS0,sum(DS1) AS SumOfDS1,sum(DS2) AS SumOfDS2,sum(DS3) AS SumOfDS3,sum(DS4) AS SumOfDS4,sum(DS5) AS SumOfDS5,sum(DS6) AS SumOfDS6,sum(DS7) AS SumOfDS7,sum(DS8) AS SumOfDS8,sum(DS9) AS SumOfDS9,sum(DS10) AS SumOfDS10,sum(DS11) AS SumOfDS11,sum(DS12) AS SumOfDS12,sum(DS13) AS SumOfDS13,sum(DS14) AS SumOfDS14,sum(DS15) AS SumOfDS15,sum(DS16) AS SumOfDS16,sum(DS17) AS SumOfDS17,sum(DS18) AS SumOfDS18,sum(DS19) AS SumOfDS19,sum(DS20) AS SumOfDS20,sum(DS21) AS SumOfDS21,sum(DS22) AS SumOfDS22,sum(DS23) AS SumOfDS23,sum(DS24) AS SumOfDS24,sum(DS25) AS SumOfDS25,sum(DS26) AS SumOfDS26,sum(DS27) AS SumOfDS27,sum(DS28) AS SumOfDS28 ----------------into #tbltotalFROM #tblcount group by State

--INSERT TOTAL RECORDS THAT HAVE AGE_INDEX 5 INSERT INTO #tblcount select * from #tbltotal

]]>https://what.thedailywtf.com/post/54005https://what.thedailywtf.com/post/54005Fri, 07 Sep 2007 12:52:10 GMTThat's simply breathtaking. I concur with snoofle, BTW. That person needs to be given some hurt. If you don't want to resort to illegal violence, then at least a large Nerf bombardment, perhaps a random one daily.
]]>https://what.thedailywtf.com/post/54008https://what.thedailywtf.com/post/54008Fri, 07 Sep 2007 13:08:37 GMT

For the love of God and all things Holy!

MY EYES!!!!

]]>https://what.thedailywtf.com/post/54014https://what.thedailywtf.com/post/54014Fri, 07 Sep 2007 13:49:33 GMTI was thinking I spend a few weeks where I give him a million razor/paper cuts and dipping him repeatedly in salt/chlorine solution. finally when I was bored I would wrap him in aluminum foil and stick him in a gigantic microwave.
]]>https://what.thedailywtf.com/post/54016https://what.thedailywtf.com/post/54016Fri, 07 Sep 2007 13:54:44 GMT@JamesKilton said:

I work for one of the larger insurance companies in the US. My sub company deals mainly with behavioral health issues. Yesterday I got presented with an interesting issue. Years ago a young kid built quite an interesting report system. I really had not touched it before although I know other developers who have. Its a continual cluster of WTFs, to say the least. This app, we shall call it App X, is used to print out various reports. Anyways several reports were printing out erroneous data, totaling things wrong etc. These reports can and do contain 100+ fields and are generated by a stored procedure. When I went to take a look at the stored procedure I was quite amazed. It was the most god-awful thing I'd seen in a long time. 1500+ lines. Finding an error in it was going to be a nightmare. Luckily the kid who wrote it was recently rehired by the company. so I walked over and asked him what the deal was with this stored procedure. Turns out years back he had written a stored procedure to create this 1500+ line stored procedure. I think the attachment speaks for itself.

The weirdest thing to me about this post (and others like it) is that you bothered to say "we shall call it App X", but then never reference that again. Why even say it???

The weirdest thing to me about this post (and others like it) is that you bothered to say "we shall call it App X", but then never reference that again. Why even say it???

The joys of unstructured writing.

]]>https://what.thedailywtf.com/post/54045https://what.thedailywtf.com/post/54045Fri, 07 Sep 2007 19:35:49 GMTHere's a one act play I have written after seeing this thread:

Steve: "Wow, the scroll bar got awfully long, this must be a popular thread."Steve: "Wait a minute, there's no way it could be that popular..."Steve: "Oh my God..."

FIN

P.S. I apparently can't reply to the first post since it's so long. The textbox just stays grayed out.
]]>https://what.thedailywtf.com/post/54057https://what.thedailywtf.com/post/54057Sat, 08 Sep 2007 03:32:46 GMTI'm surprised my writing was not worse. My work is full of WTF's like this one. The <a href="http://forums.worsethanfailure.com/forums/thread/123065.aspx">Bitprocessor</a> for example. I've been at this job for a year and things have gotten a lot better in that time. Even one of the other developers (.net) who when I started had no idea what OOP is, has learned a lot and improved, mostly by force mind you. umm ya on secod thought maybe I should find a better company. LOL!
]]>https://what.thedailywtf.com/post/54124https://what.thedailywtf.com/post/54124Mon, 10 Sep 2007 08:19:02 GMT

The scary part is that I showed this to our DBA here, and his only comment was "I've seen worse".

Demons! WHERE?!? (Apparently, he says he has seen an 80 page Stored Procedure. shudder)

]]>https://what.thedailywtf.com/post/54177https://what.thedailywtf.com/post/54177Mon, 10 Sep 2007 23:23:37 GMTugh. This one is only about 66 pages when you print it out. Tell him I now feel his pain on that one. Ugh Well I'm off to bed again. I woke up to a splitting migraine. It's like Thor is pounding my skull with Mjölnir. Probably induced by the whole host of WTF's recently Lol.
]]>https://what.thedailywtf.com/post/54185https://what.thedailywtf.com/post/54185Tue, 11 Sep 2007 07:14:51 GMT