GO Statements in Run SQL Action
What’s in a GO statement? Quite a bit actually. Contrary to popular belief, GO is not actually part of T-SQL. It is a command recognized by the sqlcmd and osql utilities and the SQL Server Management Studio Code editor. When we created the Run SQL Query update action, we included parsing on GO during the update build process, which allowed users to execute their migration scripts when including them as a .sql file. This works nicely for pure SQL. However, when SQL is inserted into the action editor, it is parsed real-time as the update is executing. In this context, the the SQL was passed directly into a SQLCommand object and executed. GOs don’t fly there. So why wouldn’t one just put their SQL into a .sql file and let the build process parse the GO statements? Shared Property expansions. If you want to use Shared Property information as part of your SQL input, things became difficult. With AppLife Update 5.1, we’ve added GO parsing to the update engine and what was once difficult, is now quite easy.