I'm working on a script I can run on new servers to do some initial configuration. I would like to be able to skip some sections but the problem I'm running into is the "GO" that's required. Because of the GO I can't wrap my sections of code in IF statements. For example
:setvar EnableDBMail 0 IF ($(EnableDBMail) = 1 ) BEGIN sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'Database Mail XPs', 1; GO RECONFIGURE GO END ....etc
The problem is this won't work because you have to use GO. Is there another way of doing this? I've tried searching but have yet to find anything.