How to tell if SQL is autogenerated by some tool I am looking into some stored procedures and the code is more or less non-readable e.g. there are 15 main joins in one statement and the level of nesting of the subqueries is e.g. 7 in order to simply define one of the tables used in the joins... If one counts the joins in the subqueries then there are many more joins... Hope it makes sense...
I do not think a human has written these SPs and I think they have generated the code and copy-pasted it in the SP template... Does this sound right?
What are these tools called? So I am trying to refactor these and I was first annoyed and thought what idiot writes code like this but now like I said I think it is autogenerated... By autogenerated I mean a drag and drop interface.
Is my inference correct based on the description above? If you could comment of performance that would be great. My understanding is that these tools are performance killers...
Trying to reverse engineering to find the tool will take too much time and you will possibly never find the solution. Debug this through an Agile methodology:
“The most efficient and effective method of conveying information to and within a development team is face-to-face conversation”
So go to your colleagues and don't be afraid to ask:
&quot;Are we using an automated tool or a drag-n-drop tool to create queries? I ask this because they really look machine-made to me&quot;
And the result can be:

Yes, they are written by a tool: and show to your colleagues how painful this choice can be for your performances
No, they are written by Tom: and talk to Tom and say &quot;Hey, Tom, I was having an hard time reading through your code, is there any way I can help you...&quot;

Be nice to people. Machines cannot change but humans can.