La gestion des erreurs en sql server

Fermé
halima15 Messages postés 167 Date d'inscription dimanche 15 novembre 2009 Statut Membre Dernière intervention 21 avril 2010 - 1 janv. 2010 à 21:54
halima15 Messages postés 167 Date d'inscription dimanche 15 novembre 2009 Statut Membre Dernière intervention 21 avril 2010 - 4 janv. 2010 à 03:10
Bonjour,
j'ai crée une procédure qui contient deux paramètres, et je veux afficher une erreur quand une de ces Deux paramètres n'est pas fourni
je sais pas comment faire et ou je dois mettre l'instruction?????????
A voir également:

1 réponse

holow1 Messages postés 680 Date d'inscription lundi 21 décembre 2009 Statut Membre Dernière intervention 7 décembre 2012 71
2 janv. 2010 à 01:04
bonjour,

voici un exemple d'un cour(.CMH) complet en anglais pour sql server 2005

USE AdventureWorks

    BEGIN TRY
      UPDATE HumanResources.Employee
      SET Gender = 'X'
      WHERE EmployeeID = 1;
    END TRY
    BEGIN CATCH
      SELECT ERROR_NUMBER(  ) ErrorNumber,
      ERROR_STATE(  ) ErrorState,
      ERROR_SEVERITY(  ) ErrorSeverity,
      ERROR_MESSAGE(  ) ErrorMessage;
    END CATCH




As shown in the example, you can use the following functions to return information about the error caught by a CATCH block:



ERROR_MESSAGE( )

Diagnostic information about the error. These messages often contain substitution variables that allow specific information, such as the database object that caused the error, to be included in the message.



ERROR_NUMBER( )

The unique error number of the error. The ERROR_NUMBER( ) function returns the last error number every time it is called. This is different from @@ERROR, which works only if it immediately follows the error or is the first statement in the CATCH block.



ERROR_SEVERITY( )

The severity level of the error. Error severities range from 0 to 24. Error levels 0 to 9 are warnings or informational.



ERROR_STATE( )

The state of the error. A state code uniquely identifies specific conditions that cause errors with the same error number.


c'est vous étiez intéresse passer ton Email ^_^
0
halima15 Messages postés 167 Date d'inscription dimanche 15 novembre 2009 Statut Membre Dernière intervention 21 avril 2010 10
4 janv. 2010 à 03:10
bien sur que je suis intéressée et voilà mon msn sabah_ilham@hotmail.com et merci pr ton aide
0