That is not a small script

time to read 1 min | 165 words

I'm doing some work on the SQL scripts, mainly converting them from cursors-style to set style, and I'm getting nice performance improvements from it.  (Greater than 5 minutes to 13 seconds). But the problem is that I'm getting a really long SQL Statement. I'm not a SQL guy, so I'm not sure how odd it is, but a 40 lines statement seems a bit too much to me (Insert from select with nested selected for some of the values.)

I'm afraid that it's not going to be easy to figure out what is going on there six month from now (OTOH, it's not easy to figure out what is happening with the cursors, either).

 

Somewhat related, I broke my personal record and tried to run a script containing over 110,000 lines (machine generated, data migration) script. My paitaince run out before it did, but I was surprised that SQL can accept such a large query (and no, that wasn't a single statement, it was several hundreds).