May 16, 2012 at 1:41 pm
capn.hector (5/16/2012)
mtassin (5/16/2012)
Brandie Tarvin (5/16/2012)
Okay, now you've peaked my interest. How do you do the help entry? Does it just do a PRINT? Or a SELECT? Or is there some other neat trick you do?
I just use Print, but you could use RAISERROR as mentioned above, not a big fan of select, as I normally have data come back in a grid... and playing games to tell me how to run the stored proc I wrote for myself doesn't thrill me.
Im the oppisite, i use select so i can have a nice header by aliasing the column with help error or some other meaningful thing.
It depends, are you propagating the error back to the application or is the usage information more for the developer as they figure out what is going on?
May 16, 2012 at 1:50 pm
Lynn Pettis (5/16/2012)
capn.hector (5/16/2012)
mtassin (5/16/2012)
Brandie Tarvin (5/16/2012)
Okay, now you've peaked my interest. How do you do the help entry? Does it just do a PRINT? Or a SELECT? Or is there some other neat trick you do?
I just use Print, but you could use RAISERROR as mentioned above, not a big fan of select, as I normally have data come back in a grid... and playing games to tell me how to run the stored proc I wrote for myself doesn't thrill me.
Im the oppisite, i use select so i can have a nice header by aliasing the column with help error or some other meaningful thing.
It depends, are you propagating the error back to the application or is the usage information more for the developer as they figure out what is going on?
back to the application. not the best way but the application just takes and displays the result of the SP. also when the SP is for a dev the SP is run through SSMS or VS and it makes the coding uniform across the organization.
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
May 16, 2012 at 1:59 pm
We tend to use RETURN in all of our SPs that are called by an application. They return 0 for success and then any number of integers depending on where the proc "errors." For example, I have a stored proc that merges data between a staging table and production table. If the delete ratio is greater than a certain amount, the proc does a RETURN 1. If the insert is greater than a certain ratio it does a RETURN 2. If the staging table has less than 100 records we RETURN 3... This way the application can be very specific about which error is causing the proc to exit during validation of data.
Jared
CE - Microsoft
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply