in
Eric Vaillancourt on SQL Server...

MS SQL Admin

Preventing Microsoft Excel or any other application from connecting to SQL Server 2005

Bookmark and Share

Today, I was asked a question on how to prevent Microsoft Excel from connecting to SQL Server.  At first I wasn’t sure how to respond to this, but I finally found a way.  It is a simple trick that uses the FOR LOGON option now available since the SP2 release of SQL Server 2005.

 

 

USE master

GO

 

CREATE TRIGGER Prevent_Apps_logon

ON ALL SERVER FOR LOGON

AS

BEGIN

      IF APP_NAME() LIKE '%excel%' -- or any other app name!

      ROLLBACK

END

 

Hope this helps,

 

Eric

 

 

 

Comments

 

fleck4257 said:

That was Soooooooo simple! Thanks a lot!

April 2, 2008 8:33 AM
 

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

April 3, 2008 4:57 PM

About Eric Vaillancourt

Eric Vaillancourt possède plus de vingt ans d'expérience en programmation de base de données et en gestion de projets. Depuis une dizaine d’années, il se spécialise en optimisation des performances et en coaching d’administrateurs de bases de données. Il a occupé des postes de haute direction dans le secteur privé, principalement dans des firmes technologiques. Il a eu l'occasion de gérer plusieurs projets liés au développement des affaires et aux changements organisationnels.
©2008 SQLProf.com & Eric Vaillancourt
Powered by Community Server (Non-Commercial Edition), by Telligent Systems