一个SQL文件,内容如下:--创建存储过程go--创建作业go--创建触发器go--备份数据库问题:
在这个SQL文件下有“创建存储过程”、“创建作业”、“创建触发器”、“备份数据库”四个过程,这四个过程可以一次全部执行吧??? 直接执行SQL文件 还是要这四个过程分开一个“Go”,一个“Go”的单独执行???
在这个SQL文件下有“创建存储过程”、“创建作业”、“创建触发器”、“备份数据库”四个过程,这四个过程可以一次全部执行吧??? 直接执行SQL文件 还是要这四个过程分开一个“Go”,一个“Go”的单独执行???
你可以自己做个试验
这里是MSDN的解释:
SQL Server utilities interpret GO as a signal that they should send the current batch of Transact-SQL statements to an instance of SQL Server.The current batch of statements is composed of all statements entered since the last GO, or since the start of the ad hoc session or script if this is the first GO.
你想执行两次
可以写
select 1
GO 2
如果在查询分析器里面执行,建议最好都加GO
如果是程序里面,就看你的程序支持不支持了,ADO里面好像不能有GO,可以用分号分割