SQL - Execute Scripts Ordered step giving error

I have added a step to run the stored procedure with library script “SQL - Execute Scripts Ordered step”.

When I’m providing the script to execute the stored procedure it is throwing the below Exception:

“Exception calling “ReadAllText” with “1” argument(s): “The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.”
Closing connection”

I believe this is because of the large text script I provide to execute in field “SQL Script File”.
As shown in examples I’m providing the stored procedure execution script directly but in library PowerShell’s scipt - $content = [IO.File]::ReadAllText($OctopusParameters[‘SqlScriptFile’])
ReadAllText is expecting something less than 260 characters.

One solution I can think of is to provide the execution script as a file with package itself. But this will be the last resort.

Please suggest the solution to this. How can I run the stored procedure directly from the step in process?

Hi @officeofprashantkumar,

Thanks for getting in touch!

This error is likely generated due to the combination of file path/filename exceeding the 260-character limit.
You could try to avoid this by changing the directory structure or file name so that it is below this limit or if your OS supports it you could enabling long paths support e.g. https://www.thewindowsclub.com/how-to-enable-or-disable-win32-long-paths-in-windows-11-10


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.