SQL Param WTF



  • It was on that third day at the One Week Job that I figured out what the guy behind me did. He and another data diddler would huddle around a 15" CRT, and crack open a stored procedure and hard-code some IDs so that each file could get imported. One would read numbers off a spreadsheet and the other would type. It wasn't like they knew SQL or anything, someone had just told them to crack open a 1,000 line proc and change the line that said:

    "UPDATE MCPRAT SET CP_ID = '34087' WHERE
    BATCH_ID IN (9863, 3523, 3511, 9077)"


    to:

    "UPDATE MCPRAT SET CP_ID = '32089' WHERE BATCH_ID IN
    (9024, 9076, 3643, 4943)"


    Then they would execute the proc.  Then they change some more IDs.  Then they would execute the proc.  And so on, and so on, and so on...

    It was like this shop hadn't learned about input parameters, or they just said screw it. And they had these guys doing this all day.



  • Is it too late to burn the place to the ground?



  • @TunnelRat said:

    And they had these guys doing this all day.

    You should go mention to them that you can use input parameters in SQL sprocs. If they are like some people, they'll get more offended than to agree than to take your advice.  It might be outside their skill level to comprehend.



  • Someone with some amount of programming skill had to have written a report capable of going to the database and getting those IDs.  Why not do the update right there, where no human intervention is needed?  It would probably all fit in one update statement, no Params ever needed.
     



  • @pitchingchris said:

    @TunnelRat said:

    And they had these guys doing this all day.

    You should go mention to them that you can use input parameters in SQL sprocs. If they are like some people, they'll get more offended than to agree than to take your advice.  It might be outside their skill level to comprehend.

    No, TunnelRat did the right thing according to the title of this series.  Two days after seeing this, he left, never to return.

    Of course not before he was able to collect tons of fodder for his hate cannon; some of which seems deserved. 



  • @KattMan said:

    No, TunnelRat did the right thing according to the title of this series.  Two days after seeing this, he left, never to return.

    Of course not before he was able to collect tons of fodder for his hate cannon; some of which seems deserved. 

    But if you hate the hater, does that make you a hater?

     



  • @TunnelRat said:

    @KattMan said:

    No, TunnelRat did the right thing according to the title of this series.  Two days after seeing this, he left, never to return.

    Of course not before he was able to collect tons of fodder for his hate cannon; some of which seems deserved. 

    But if you hate the hater, does that make you a hater?

     

    I don't think so.  I can dislike you, but that doesn't mean I think you are always wrong.  Your validity has no reliance on my approval.  I understand that.  If I said you were always wrong simply on the basis that I do not like you, then yes, I would be no better than a simple "hater".


Log in to reply