Home > SQL Server > Get Session Application Name in SQL Server

Get Session Application Name in SQL Server


APP_NAME() function returns the application name for the current session of a connection. This name should be set by the application developer in their application.

This function returns a value of the type nvarchar and its size is 128 characters.

How to set Application name?

Example 1: Execute the following query in SSMS query window as shown below

pic1

We can also see the Application names that are connected to SQL Server using Active Monitor.

pic2Activity Monitor window

pic3Example 2: Setting Application name in the SSIS OLE DB connection name.

Step 1: Configure the OLE DB connection with the local/Remote SQL Server instance and set the application name as given below.

pic4

Step 2: Add execute SQL Task and configure the task as shown below.

pic5Step 3: Execute the package and Open the SQL Server Activity monitor

pic6

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: