ingresso avvertimento xp_logevent
-
23-09-2019 - |
Domanda
ho potuto in grado di fare una voce di messaggio come un avviso nel registro eventi di sistema utilizzando xp_logevent
Nessuna soluzione corretta
Altri suggerimenti
Ecco la documentazione sul xp_logevent (Transact-SQL)
quando mi sono imbattuto questo esempio (dalla documentazione di cui sopra su SQL Server 2005 Enterprise su Windows Server 2003 Enterprise):
--I'm not sure why they declare their local variables with @@, but this code is right from the documentation
DECLARE @@TABNAME varchar(30)
DECLARE @@USERNAME varchar(30)
DECLARE @@MESSAGE varchar(255)
SET @@TABNAME = 'customers'
SET @@USERNAME = USER_NAME()
SELECT @@MESSAGE = 'The table ' + @@TABNAME + ' is not owned by the user
' + @@USERNAME + '.'
USE master
EXEC xp_logevent 60000, @@MESSAGE, informational
c'era un messaggio nel registro di sistema:
Type: Informational
Source: MSSQLSERVER
Category: (2)
Event: 17061
User: N/A
Description: Error: 60000 Severity: 10 State: 1 The table customers is not owned by the user dbo.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow