Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

APP_NAME (Transact-SQL)

Returns the application name for the current session if set by the application.

Topic link icon Transact-SQL Syntax Conventions

APP_NAME  ( )

nvarchar(128)

The following example checks whether the client application that initiated this process is a SQL Server Management Studio session.

USE AdventureWorks2012;
GO
DECLARE @CurrentApp varchar(128)= APP_NAME();
--SELECT @CurrentApp;
IF @CurrentApp <> 'Microsoft SQL Server Management Studio - Query'
PRINT 'This process was not started by a SQL Server Management Studio query session.' ;
GO
GO
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.