SQL Server 2000
Returns the application name for the current session if set by the application.
APP_NAME ( )
This example checks whether the client application that initiated this process is a SQL Query Analyzer session.
DECLARE @CurrentApp varchar(35) SET @CurrentApp = APP_NAME() IF @CurrentApp <> 'MS SQL Query Analyzer' PRINT 'This process was not started by a SQL Query Analyzer query session.'