首页 > 代码库 > Visual studio 中编译错误SQL71006: Only one statement is allowed per batch. A batch separator, such as 'GO', might be required between statements.

Visual studio 中编译错误SQL71006: Only one statement is allowed per batch. A batch separator, such as 'GO', might be required between statements.

把写好的sql脚本,并在mssqlmanager里面编译成功的存储过程脚本复制到vs项目下,出现错误信息如下:SQL71006: Only one statement is allowed per batch. A batch separator, such as ‘GO‘, might be required between statements.加上GO,出现

Error 5 SQL70001: This statement is not recognized in this context.

大意是不允许多条语句在一个脚本里面。

 

解决方案:VS错认为你的文件是DDL文件,所以它试图编译,解决方案是,右键文件---属性-----Build Action---None