April 26, 2006 at 3:10 pm
Hi All,
I have a stored Procedure which calls 2 other procedures
Through a cursor.These two nested procedures are for
inserting and updating a few tables.
I have to modify it --
Before running the cursor,I have to ensure that an
involved table has n or more records .
If more,I have to process first n and then
next n records and so on.
Please help me in thinking about the solution.feel free
to ask any question.
April 26, 2006 at 4:01 pm
The IF statement is used to test for a condition. The resulting flow of control depends on whether the optional ELSE statement is specified:
When the IF statement evaluates to TRUE, the statement or block of statements following the IF statement are executed. When the IF statement evaluates to FALSE, the statement, or block of statements, following the IF statement is skipped.
When the IF statement evaluates to TRUE, the statement, or block of statements, following the IF statement, is executed. Then control jumps to the point after the statement, or block of statements, following the ELSE statement. When the IF statement evaluates to FALSE, the statement, or block of statements, following the IF statement is skipped and the statement, or block of statements, following the optional ELSE statement is executed.
For example, if a stored procedure has been saving any error codes returned by @@ERROR during a transaction, it might have an IF statement similar to the following at the end of the procedure:
IF (@ErrorSaveVariable <> 0)BEGIN PRINT 'Errors encountered, rolling back.' PRINT 'Last error encountered: ' + CAST(@ErrorSaveVariable AS VARCHAR(10)) ROLLBACKENDELSEBEGIN PRINT 'No Errors encountered, committing.' COMMITENDRETURN @ErrorSaveVariable
©1988-2000 Microsoft Corporation. All Rights Reserved.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply