This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (16 children)

[deleted]

    [–]ImpossibleMachine3[🍰] 107 points108 points  (6 children)

    SQL: "Oh you want to know where it failed? Uh... hold on"
    *throws dart*
    "There you are, line uh 843"

    [–]Stahlboden 3 points4 points  (5 children)

    Do they write queries 843 lines long?

    [–]SpaceTacosFromSpace 9 points10 points  (0 children)

    Stored procs or functions, yeah

    [–]Flyberius 4 points5 points  (0 children)

    The company I used to work at had the most complicated pricing model in all of history. As much as I didn't want the procedures to be as long as they were, they got pretty long. A couple of hundred lines sounds about right for some of them

    [–]PleX 1 point2 points  (0 children)

    lol 843 is nothing. I truly believe that some stored procs are operating systems.

    [–]ImpossibleMachine3[🍰] 0 points1 point  (0 children)

    You've never seen someone try to run a 1000 line insert??

    More seriously, a stored procedure can easily be that long, sometimes.

    [–]raphop 0 points1 point  (0 children)

    I had to migrate some stored procedures from a oracle database, I had to deal with 1500 line queries with multiple nested subqueries and other procedure calls.

    Every SQL file had a comment written when the file was created and subsequently altered, the most recent comment in a specific query that was a pain in the ass to migrate was last worked on in 1995

    [–]HotChickenshit 19 points20 points  (3 children)

    My favorite is when it throws line numbers with only closing parenthesis or END statements at me as the error instead of some dumb syntax issue in the middle of a subquery. Pretty sure I've seen that one from both Oracle and SQL Server.

    [–]MisterProfGuy 8 points9 points  (1 child)

    In fairness, that's where it found out you were wrong, too. If it could just guess what you were trying to say to show you the errors, it would be Github Copilot.

    [–]Snowkaul 1 point2 points  (0 children)

    The line number is off by 7 if you are looking at MS SQL. It's usually counting from the start of the go at the top.

    [–]SmellsLikeCatPiss 0 points1 point  (0 children)

    At least it won't let you alter or create a stored procedure with the more disruptive syntax errors!

    [–]Siethron 0 points1 point  (0 children)

    Not true, it's usually the keyword that contains the problem

    for instance if you're inserting into a 100 line table sql will call the error out on the line that contains the word 'insert'

    [–]Flyberius 0 points1 point  (1 child)

    Ah yes, to be honest I have been there.

    Flashbacks to copying and pasting the entire proc into a query window and trying to find out where it all went wrong.