Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[OT] BEGIN in SQL Server

0 views
Skip to first unread message

Francy

unread,
Sep 24, 2001, 4:53:26 AM9/24/01
to
A cosa serve???

Me lo spiegate in modo chiaro e sul NG??
Per piacere!!!

1000 GRAZIE


Igor Damiani

unread,
Sep 24, 2001, 6:16:06 AM9/24/01
to
intendi la parola chiave BEGIN ?
viene usata dentro le stored procedure per delimitare i blocchi di
istruzioni SQL.......
un po' come { e } nel C/c++/Java e cosě via.......
--
Damiani Liborio Igor
idam...@hotmail.com - igor.d...@light.it
http://www.igordamiani.it
ICQ : 11847262


Ugo Mangini

unread,
Sep 24, 2001, 6:30:20 AM9/24/01
to

"Francy" <fral...@libero.it> ha scritto nel messaggio
news:awCr7.37185$P04.2...@news2.tin.it...

> A cosa serve???
>
> Me lo spiegate in modo chiaro e sul NG??
> Per piacere!!!
>

Cito da Books Online (mi sembra chiarissimo):


Using BEGIN...END
The BEGIN and END statements are used to group multiple Transact-SQL
statements into a logical block. Use the BEGIN and END statements anywhere a
control-of-flow statement must execute a block of two or more Transact-SQL
statements.
For example, when an IF statement controls the execution of only one
Transact-SQL statement, no BEGIN or END statement is needed:
IF (@@ERROR <> 0)
SET @ErrorSaveVariable = @@ERROR

If @@ERROR is 0, only the single SET statement is jumped.
Use BEGIN and END statements to make the IF statement skip a block of
statements when it evaluates to FALSE:
IF (@@ERROR <> 0)
BEGIN
SET @ErrorSaveVariable = @@ERROR
PRINT 'Error encountered, ' +
CAST(@ErrorSaveVariable AS VARCHAR(10))
END

The BEGIN and END statements must be used as a pair: one cannot be used
without the other. The BEGIN statement appears on a line by itself followed
by the block of Transact-SQL statements. Finally, the END statement appears
on a line by itself to indicate the end of the block.
The BEGIN and END statements are used when:
A WHILE loop needs to include a block of statements.
An element of a CASE function needs to include a block of statements.
An IF or ELSE clause needs to include a block of statements.


ciao
ugo

p.s.
Se invece intendevi BEGIN TRANSACTION la cosa si fà più lunghetta:
chiedi e ti sarà detto... :-P

ri-ciao
ugo

Igor Damiani

unread,
Sep 24, 2001, 6:37:50 AM9/24/01
to
GULP!!!!!
mi hai distrutto.......bravo.....
:-)))
risposta super-completa.......

Ugo Mangini

unread,
Sep 24, 2001, 6:48:32 AM9/24/01
to

"Igor Damiani" <igor.d...@light.it> ha scritto nel messaggio
news:9on1em$gk4$1...@fe1.cs.interbusiness.it...

> GULP!!!!!
> mi hai distrutto.......bravo.....
> :-)))
> risposta super-completa.......
> --

Io?
SqlServer Books Online, semmai... :)

ciao
ugo


Francy

unread,
Sep 24, 2001, 6:53:12 PM9/24/01
to
Si bravo!!!
Adesso me lo tradurresti parola x parola???

No xche mi e' capitato di toppare la traduzione una volta e da allora se
possibile preferisco la spiegazione in italiano!!!

Non conosci dove me la posso leggere bene in italiano???

GRAZIE e scusami ma non riesco a capire...

"Ugo Mangini" <ugoma...@tiscalinet.it> ha scritto nel messaggio
news:9on2uj$h58$1...@lacerta.tiscalinet.it...

hal1961

unread,
Sep 24, 2001, 8:21:59 PM9/24/01
to
Francy ha scritto:

>Si bravo!!!
>Adesso me lo tradurresti parola x parola???

Urge un vocalbolario di inglese ;-)
Non prendertela, ma per fare questo mestiere
serve conoscere l' inglese, almeno limitatamente a quello tecnico
informatico, piuttosto che il vb.

ciao, hal


0 new messages