Let’s GO

Going back one year, when I worked in China, the scene we argued on the exact use of “GO” in TSQL is still clear till today.

This is a tiny corner of SQL Server statement however I reckon most of us may not have a solid understanding on this. Here I would use this post to clarify the GO statement in TSQL.

  • “GO” is to seperate the statements into batches.
  • Every batch is a set of commands submitted to SQL server DB engine.
  • Furthermore, Batches determine variable scope and name resolution.

(not easy to understand, maybe easy, think about you delcare one variable in the beginnig, which is repeatedly used in all this page. If inserting any row “GO” in the middle, which means you announce to finish the scope of the variable using onwards.)   

Well, Let’s “GO”. Take yours aways.

 

Advertisements