Hi, I want to exit a stored procure when certain conditions are true.
You can use stored proc the RETURN statement for that.
.
..
...
DECLARE
@CHECK001
AS INT
SET @CHECK001
= (SELECT COUNT(*) FROM tablename
) -->create condition
if
(@CHECK001
= 0
) -->check condition
BEGIN
PRINT 'There are no records to process!'
RETURN -->exit the stored proc from here
END
...
..
.