PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.sqlserver.server > General Exception Handler?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
General Exception Handler?

Réponse
 
LinkBack Outils de la discussion
Vieux 13/06/2008, 09h00   #1
Stefan Gerdts
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut General Exception Handler?

Hi,

I'm wondering if there's a means to execute a stored prodecure (or perhaps a
single SQL statement) whenever an error is raised (whether manually using
RAISERROR or automatically from SQL Server) for means of logging. For
example, I'd like to fill a table with all raised errors, or to send an
e-mail every time.

Thanks in advance!
  Réponse avec citation
Vieux 13/06/2008, 17h16   #2
Aaron Bertrand [SQL Server MVP]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: General Exception Handler?

Well, you can easily add a call to a custom logging stored procedure in
every place where you are currently doing a RAISERROR and/or TRY/CATCH.

And certain error level/severity are already logged to the SQL Server error
log.

Do you really want to log every time I try to try to run a query and have a
syntax error? Not even sure if you can lower the "log to error log" bar
that low, or if you could set up some kind of event sink for it (I don't
think that there is a server trigger that could capture all RAISERROR
events). But if your systems and users are anything like most of the ones I
deal with, even if you could do this, your logging data growth would quickly
outpace your real business data, and it would likely have an extremely low
signal to noise ratio.

A


On 6/13/08 3:00 AM, in article
A14F4AF5-3C04-4820-8803-42B0AE85D4C6@microsoft.com, "Stefan Gerdts" <Stefan
Gerdts@discussions.microsoft.com> wrote:

> Hi,
>
> I'm wondering if there's a means to execute a stored prodecure (or perhaps a
> single SQL statement) whenever an error is raised (whether manually using
> RAISERROR or automatically from SQL Server) for means of logging. For
> example, I'd like to fill a table with all raised errors, or to send an
> e-mail every time.
>
> Thanks in advance!


  Réponse avec citation
Vieux 15/06/2008, 17h34   #3
newscorrespondent@charter.net
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: General Exception Handler?

You will have to deal with something subsequent to the procedure doing a
rollback if you are in a transaction. There is no way within TSQL to create
a second seperate transaction.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h09.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09833 seconds with 11 queries