When working with Database Projects you will sometimes want to use a post-deploy script to perform any number of operations on the database every time the database project is deployed to a target database. In doing so you may encounter an error such as the following:
‘Error SQL71006: Only one statement is allowed per batch. A batch separator such as ‘GO’, might be required between statements.’
To work around this issue, you will first want to deploy the database project (without the post-deploy script) to a test database, then run your post-deploy script through a tool such as SQL Server Management Studio (SSMS) to ensure that there isn’t a problem with your SQL script. Assuming your SQL script runs without issue (or it has an issue which you correct but still encounter a SQL error) you can follow these steps to work around this known problem.
To fix this error:
1. Right click on the .sql script file and select ‘Properties’.
2. Set the Build Action to 'None'.
3. Now rebuild and run.
By setting the build action to ‘None’ the script(s) will not compile at runtime, overcoming the error. This is a known issue and hopefully will be resolved soon. The above is a workaround for the error and not a permanent fix so please keep this in mind.