Sql Server Error: is not a recognized Function name

Asked

Viewed 548 times

2

I have two functions in 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 am used in SQL Server 2000

  • Tried APP_NAME instead of PROGRAM_NAME? What version of SQL Server is?

  • I’m using the Sqlserver 2000 version

  • My condolences for having to use this version.

1 answer

3

The ORIGINAL_LOGIN() command is as of 2008 as described in the command documentation. Link

Same thing for APP_NAME() and PROGRAM_NAME command(). 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 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.