Killing An Active Login Connection To Dynamics GP From SQL

From time to time I am notified by users that they are unable to log into Dynamics GP due to the login screen not allowing them to manually kill their existing connection.  When a user closes out of Dynamics GP without actually logging out, their login remains connected to the DYNAMICS database.  When they attempt to log back in the application will notify them that their account is already logged into the company they are attempting to access and give them an option to view their current logins as illustrated in the screenshot below.


By clicking Yes, a new window will appear showing the current user login activity and giving the user the ability to delete the current login.


In most scenarios this feature works just fine.  However, I have discovered that if Dynamics GP has been deployed through a Citrix environment, as well as some other application hosting environments, this feature does not always work.  In most cases once the user clicks Delete they are immediately returned to the login screen but when attempting to log in, they are prompted once again to view their current login and attempt to delete it.

When this issue occurs the only way to resolve it and allow the user to log into Dynamics GP is to connect to the SQL server housing the DYNAMICS database and kill the connection manually.

Though your first thought might be to run the sp_who2 command, locate the SPID and kill it, this is actually not a good idea as you can actually have multiple SPIDs for a single user and you don’t want to run the risk of killing the wrong one.

Instead, open a query window and run the following script to show all GP logins that are actively connected to the Dynamics GP application.

From the list of results simply locate the user’s ID that needs to be removed and run the following script to close their connection.  In this example I am killing the connection of userID Jack.

Once the above script has been executed the user experiencing the login issue should now be able to log into the Dynamics GP application.  As far as I know this is a known issue with Microsoft and hopefully something they will be resolving down the road.