Here is a simple example:
DECLARE @retval INT
EXEC @retval = sys.sp_who
IF @retval = 0 -- success
BEGIN
PRINT 'Success'
END
ELSE
BEGIN
PRINT 'Failure'
END
By default stored procedures return 0 for success, but you can specify any integer for the return value based on whay happend in your stored procedure.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question