Invoke-Sqlcmd -Query "ALTER AVAILABILITY GROUP $AAG REMOVE DATABASE $DB " -ServerInstance $Instance
Invoke-Sqlcmd : Incorrect syntax near '-'.
Msg 102, Level 15, State 1, Procedure , Line 1.
Hello all,
As you can see from the sample above $AAG contains 'MY-AG' (not the real AG name but the hyphen is in the name) results in SQL interpreting (presumption on my part) the - as a parameter delimiter???? Any ideas, suggestions or proven methods to overcome this? Many thanks for your help