"DFS" <no****@nospam.com> wrote in message
news:10*************@corp.supernews.com...
Version 1:
--------------------------------
If Condition = A
UPDATE query 1
UPDATE query 2
ELSE IF Condition = B
UPDATE query
Version 2:
--------------------------------
If Condition = A
BEGIN
UPDATE query 1
UPDATE query 2
END
ELSE IF Condition = B
BEGIN
UPDATE query
END
Or are they functionally equivalent?
Thanks
See the Books Online entry for IF ... ELSE ... Version 1 is not valid
syntax - IF must be followed by a single SQL statement, or by a block of
statements enclosed in BEGIN ... END. Version 2, on the other hand, is
correct. Try it yourself in Query Analyzer, and you should get a syntax
error using version 1.
Simon