Sorry for the basic question here but when is it best to create new BEGIN, END, and GO blocks for SQL Statements? In my case, I have a stored procedure that I created, below is a snippet:
I have something like this:
CREATE PROCEDURE p_Test
SET NOCOUNT ON;
INSERT INTO etc, etc
The above snippet has just one insert statement, but if I had multiple insert statements that weren't necessarily related should I create a new BEGIN END block for the each of the other insert statements?
- Does BEGIN END cause the statements to be executed in a transaction block so if one statements failed, it would rollback or is that done differently?
- When is GO needed?
View Complete Post