Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IF BEGIN END confusion
Message
From
16/06/2008 11:31:26
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01324368
Message ID:
01324440
Views:
11
>No, BEGIN is nothing like THEN. Unlike in VFP, only the first statemet after IF will be executed in T-SQL when IF condition is true. To execute more than one statement, you've to enclose them into BEGIN...END blok.
>

That is what he did in his second example and it wasn't working. If the Print executes after the IF statement then the IF must be true and it should execute when placed inside the Begin - End. And I think is why he is confused.

Tim

>
>>So, the BEGIN is almost like THEN? The lines before the BEGIN always exectute, but those inside the BEGIN only execute if the IF condition is true? If that is the case, then my IF condition must not be true for the behavior I'm seeing.
>>
Timothy Bryan
Previous
Reply
Map
View

Click here to load this message in the networking platform