Note: This is a custom script. Support does not troubleshoot or support custom customer scripts.
Temporary workaround was to shorten the name of the Sharepoint database.
There was an error in the custom script. The SQL statement was over 600 characters, which was over the variable declaration for @SQLStr as varchar (600).
Once the string limit was increased, the script ran successfully.