all groups > sql server programming > march 2004 >
You're in the

sql server programming

group:

begin


begin Frank Dulk
3/28/2004 9:12:23 PM
sql server programming:
Does the begin only serve for of the the rollback in case of mistake?

Re: begin Vishal Parkar
3/29/2004 7:21:22 AM
hi Frank,

BEGIN is no way related with the transaction. you can group multiple transact sql statements
into a logical block using begin and end statement.

For example within and IF condition you want to execute multiple statement you can have syntax
as follows.

if (1=1)
begin
select * from northwind..customers where customerid = 'ALFKI'
print 'rows affected :' + cast(@@rowcount as varchar(5))
end

to be more precise what you are looking for is "begin transaction" statement, which helps you
to keep data in a consistent state, within a transaction and in case of any error you can use
"rollback transaction".

See more help on following topics and its subtopics in in books online.

"ROLLBACK TRANSACTION"
"BEGIN TRANSACTION"

--
Vishal Parkar
vgparkar@yahoo.co.in


AddThis Social Bookmark Button