I have 4 sql scripts that I want to run in a DACPAC in PostDeployment, but when I try to build the VS project for 3 of them I get this error:
Only one statement is allowed per batch. A batch separator, such as 'GO', might be required between statements.
The scripts contain only INSERT
statements in different tables on the DB. And all of them are structured like so
IF NOT EXISTS (SELECT 1 FROM dbo.Criteria WHERE Name = 'Mileage') INSERT INTO dbo.Criteria(Name) VALUES ('Mileage'); only on different tables and with different data.
My question is why is VS complaining about 3 of them when all the scripts are the same in terms of syntax and operations?
PS: Adding 'GO' between statements as the error suggests doesn't do anything.
I have found the problem. When I added the file in VS I forgot to set Build Action = None
from the file properties. So changing that fixed the problem and the project now compiles.