Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

APP_NAME (Transact-SQL)

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

Topic link icon Transact-SQL Syntax Conventions



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

USE AdventureWorks;
DECLARE @CurrentApp varchar(40)
SET @CurrentApp = APP_NAME()
IF @CurrentApp <> 'SQL Server Management Studio - Query'
PRINT 'This process was not started by a SQL Server Management Studio query session.';
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft