Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 SP that returns status -1 if error, 1 if success,

Author  Topic 

daman
Yak Posting Veteran

72 Posts

Posted - 2007-11-23 : 17:48:43
Is there some example of how i can add a return status into my stored procedure to have an extra field where I can verify if it runs successfully
1 if success
-1 if error (server, etc)
0 if empty record return

Thanks

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2007-11-23 : 18:49:14
Right click script procedure as execute to new query window for syntax that does this automatically (return status = 0 if successful, 1 if not)



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-11-23 : 21:56:04
You can either use RETURN or OUTPUT parameters to achieve this. I prefer to use RETURN to indicate success and failure. IMO, OUTPUT parameters are more for providing data back to the application.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -