Click here to Skip to main content
15,888,610 members
Home / Discussions / Database
   

Database

 
GeneralRe: Dynamic sql Query Pin
shinboxe25-Nov-08 10:15
shinboxe25-Nov-08 10:15 
GeneralRe: Dynamic sql Query Pin
Ashfield25-Nov-08 21:17
Ashfield25-Nov-08 21:17 
GeneralRe: Dynamic sql Query Pin
Umair Feroze26-Nov-08 3:44
Umair Feroze26-Nov-08 3:44 
QuestionRe: Dynamic sql Query Pin
Ashfield26-Nov-08 8:36
Ashfield26-Nov-08 8:36 
AnswerRe: Dynamic sql Query Pin
shinboxe27-Nov-08 7:47
shinboxe27-Nov-08 7:47 
QuestionVista Home Premium - install SQL 2005 Express with Reporting Service? Pin
devvvy25-Nov-08 5:24
devvvy25-Nov-08 5:24 
AnswerRe: Vista Home Premium - install SQL 2005 Express with Reporting Service? Pin
Jerry Hammond25-Nov-08 18:19
Jerry Hammond25-Nov-08 18:19 
QuestionIs having an error handler in every single stored procedure excessive? Pin
emunews25-Nov-08 3:21
emunews25-Nov-08 3:21 
One of our clients has just developed a set of coding standards for their .NET and SQL Server application development. For the SQL Server standards, they say the following regarding error handling:

-----------start of quote---------------
Error Handling
- Should be used in every stored procedure, with an Error Handling section
at the bottom of the procedure
- Stored procedures should return the success or failure of the stored
procedure by returning 0 (zero) upon success, or return the error number upon
error.
- @@ERROR should be checked after Every INSERT or UPDATE to deterimine the
success or failure of that action.
- @@ROWCOUNT should be checked after every INSERT or UPDATE if at least one
or more records were expected to be affected.

DECLARE @Error int, @RowCount int

T-SQL here

RETURN 0
EH:
RAISERROR(@Error, 16, 1)
RETURN @Error

-----------end of quote---------------

Does this sound like a good idea? Having an error handler in every stored procedure seems excessive.

Honestly, I'm of the opinion that error handling for the sake of error handling is a waste of time and only serves to obsficate your code. The only reason why you should handle an error is if you're going to do something meaningful with the exception. For example, you know what the error is and how to fix it. Or maybe you want to log it to the database. Or you need to rollback a transaction. But if all you're going to do is catch it and raise it up the call stack, that's pointless code because the error will bubble up the callstack anyway.

Do you agree or disagree? Why or why not?
AnswerRe: Is having an error handler in every single stored procedure excessive? Pin
Ashfield25-Nov-08 5:21
Ashfield25-Nov-08 5:21 
GeneralRe: Is having an error handler in every single stored procedure excessive? Pin
emunews25-Nov-08 10:59
emunews25-Nov-08 10:59 
GeneralRe: Is having an error handler in every single stored procedure excessive? Pin
Ashfield25-Nov-08 21:08
Ashfield25-Nov-08 21:08 
GeneralRe: Is having an error handler in every single stored procedure excessive? Pin
emunews26-Nov-08 2:24
emunews26-Nov-08 2:24 
GeneralRe: Is having an error handler in every single stored procedure excessive? Pin
Ashfield26-Nov-08 8:42
Ashfield26-Nov-08 8:42 
GeneralRe: Is having an error handler in every single stored procedure excessive? Pin
emunews26-Nov-08 9:11
emunews26-Nov-08 9:11 
AnswerRe: Is having an error handler in every single stored procedure excessive? Pin
emunews1-Dec-08 8:12
emunews1-Dec-08 8:12 
GeneralRe: Is having an error handler in every single stored procedure excessive? Pin
Wendelius1-Dec-08 10:40
mentorWendelius1-Dec-08 10:40 
GeneralRe: Is having an error handler in every single stored procedure excessive? Pin
emunews2-Dec-08 3:59
emunews2-Dec-08 3:59 
GeneralRe: Is having an error handler in every single stored procedure excessive? Pin
Wendelius2-Dec-08 4:08
mentorWendelius2-Dec-08 4:08 
AnswerRe: Is having an error handler in every single stored procedure excessive? Pin
emunews20-Jan-09 5:40
emunews20-Jan-09 5:40 
QuestionRead Output parameter with ExecuteReader in DAAB Pin
Meysam Mahfouzi24-Nov-08 22:57
Meysam Mahfouzi24-Nov-08 22:57 
AnswerRe: Read Output parameter with ExecuteReader in DAAB Pin
Ashfield25-Nov-08 0:50
Ashfield25-Nov-08 0:50 
QuestionDoes anyone know if it is possible to supply multiple queries and tables to exp - so that the result is a single export file ? Pin
by824-Nov-08 20:14
by824-Nov-08 20:14 
AnswerRe: Does anyone know if it is possible to supply multiple queries and tables to exp - so that the result is a single export file ? Pin
Wendelius27-Nov-08 4:09
mentorWendelius27-Nov-08 4:09 
QuestionBroken replication Pin
thaarM24-Nov-08 18:46
thaarM24-Nov-08 18:46 
Questionthanks Pin
Abhilash124-Nov-08 17:54
Abhilash124-Nov-08 17:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.