Error in Sql Server: is not a recognized function name

2

I have two functions in the sql server that are not being recognized by the database

-- Não loga conexões de usuários de sistema
IF (ORIGINAL_LOGIN() IN ('sa', 'AUTORIDADE NT\SISTEMA', 'NT AUTHORITY\SYSTEM') OR ORIGINAL_LOGIN() LIKE '%SQLServerAgent')
    RETURN

and

-- Não loga conexões de softwares que ficam se conectando constantemente
IF (PROGRAM_NAME() LIKE 'Red Gate%' OR PROGRAM_NAME() LIKE '%IntelliSense%' OR PROGRAM_NAME() = 'Microsoft SQL Server')
    RETURN

The message I get is:

  

'ORIGINAL_LOGIN' is not a recognized function name.   Server: Msg 195, Level 15, State 1, Procedure Audit_Login, Line 49   'EVENTDATA' is not a recognized function name.   Server: Msg 170, Level 15, State 1, Procedure Audit_Login, Line 52

I'm using SQL Server 2000

    
asked by anonymous 15.04.2016 / 17:28

1 answer

3

The ORIGINAL_LOGIN () command is from the 2008 release, as described in the command documentation. (SQL12.SWB.TSQLQUERY.F1); k (MISCELLANEOUSFILESPROJECT); k (DevLang-TSQL) & rd = true "> Link

Same thing for the APP_NAME () and PROGRAM_NAME () commands. Link

An output can be the select below.

select spid, status, loginame, 
hostname, blocked, db_name(dbid) as databasename, cmd, program_name 
from master..sysprocesses
where db_name(dbid) like '%<database_name>%'
and spid > 50 
    
04.01.2017 / 17:23