In SQL Server, when should you use GO and when should you use semi-colon ;?

后端 未结 5 1807
南方客
南方客 2020-12-04 10:51

I’ve always been confused with when I should use the GO keyword after commands and whether a semi-colon is required at the end of commands. What is the differences and why/w

5条回答
  •  醉酒成梦
    2020-12-04 11:15

    GO is a batch terminator, a semi-colon is a statement terminator.

    you will use GO when you want to have multiple create proc statements in 1 script because create proc has to be the first statement in a batch. If you use common table expressions then the statement before it needs to be terminated with a semi-colon

提交回复
热议问题