0

I was trying to validate all my SQL files using the below scripts but somehow its throwing an error. Need help.

cd D:\My_System\rgbumerch\test

Get-ChildItem .\*.sql | Select -ExpandProperty FullName | ForEach { $query = (Get-Content -Path $_); Check-Query-Syntax $str }

Error:

Check-Query-Syntax : The term 'Check-Query-Syntax' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:2 char:102
+ ... ForEach { $query = (Get-Content -Path $_); Check-Query-Syntax $str }
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Check-Query-Syntax:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

2
  • 3
    What is Check-Query-Syntax supposed to be? Commented Jul 5, 2021 at 21:29
  • .. and $str is also undefined.. Commented Jul 6, 2021 at 18:51

1 Answer 1

2

Try replacing Check-Query-Syntax $str for this Check-Query-Syntax $query

Sign up to request clarification or add additional context in comments.

1 Comment

Also, can you please share how the function Check-Quey-Syntax is declared or how you import the module?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.