tsql - When do I need to use Begin / End Blocks and the Go keyword in SQL Server? -


Can anyone tell me when and where I started start and end Block in SQL Server?
Besides, what does go do?

Go is like the end of a script.

You can create multiple rules, this is a way of separating one part of a script from the other divided by GO, but it is depositing everyone in one block.


BEGIN and END C / ++ / #, Java, etc.

They built a logical block of code, I use BEGIN and END at the start and end of a stored operation, but it is not strictly necessary there. Where it is necessary for loops, and if the statements, etc., where you need a further step ...

  if existing (my _table from WHERE id = @id Select) BEGIN INSERT log select ID, 'deleted' deleted my_table WHERE id = @id END  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -