Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "Could not find stored procedure 'GO'." #79

Open
Jason-De opened this issue Dec 8, 2020 · 0 comments
Open

Error: "Could not find stored procedure 'GO'." #79

Jason-De opened this issue Dec 8, 2020 · 0 comments

Comments

@Jason-De
Copy link

Jason-De commented Dec 8, 2020

I get the error: Error running SQL script: Exception calling "ExecuteNonQuery" with "0" argument(s): "Could not find stored procedure 'GO'."

This happens because there are two or more "GO" statements back to back. The fix for this is to check to see if the only text is a GO statement in the object. Both commands in the switch statement (lines 54 and 58) can be replaced with:
ForEach-Object { $SqlCmd.CommandText = $_.Trim(); if (!$SqlCmd.CommandText.Equals("GO")) {$reader = $SqlCmd.ExecuteNonQuery()} }

This resolves the issue no matter how many GO statements there are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant