Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Good practice of returning error from store proc
Message
De
24/05/2012 14:28:12
 
 
À
24/05/2012 14:25:30
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01544314
Message ID:
01544315
Vues:
33
IIRC, yes, every stored procedure that could generate an error should have an output parameter. Mine was always called ErrorMessage (or some such) and used to pass back the Error Message - which can be done, again iirc, through raiseerror?


>Hi,
>
>In my VFP stored procedures I always returned a string; empty if no problem occurred; or the string would have a description of the error, if a problem occurred.
>
>In SQL Server stored procedures, I learned today, I can only return an integer. I am thinking about returning 0 if no problem and -1 if there is a problem. Then, if there is a problem, set to an OUTPUT parameter the value of error message. I am wondering if this would be a good practice? My concern is that then each and every stored procedure would have to have an OUTPUT parameter.
>
>I would appreciate any suggestions on this topic. TIA.
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform