Get Application Name In SQL Server 2008

In this article I tell you about how to get application name for the current session in SQL Server.
  • 2462

In this article I tell you about how to get application name for the current session in SQL Server. One of the easiest way is to use the App_Name() function.

App_Name() function returns the application name  from which data come. Its return type is nvarchar(128). Consider the following example.

Use APP_NAME() function in select clause.

ApplicationName.jpg

Now consider this stored procedure to check the application name returned by the connection and return the name of application.

ApplicationName01.jpg

This example specifies that data are inserted from Query Analyser. It decides where data come from.

© 2019 DotNetHeaven. All rights reserved.