September 27, 2024 at 5:17 pm
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
September 27, 2024 at 7:57 pm
put both around square brackets e.g. [$AAG] and [$DB]
September 28, 2024 at 11:44 am
Thank you Frederico,
Can you please point me to where I can read/learn more on this? Searched for documentation and it seem lacking. Thank you
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy