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