Overview
Some of the code samples on our website use SQL Server’s OLE Automation stored procedures. Because those procs are disabled by default, we’ve provided a Microsoft code sample to enable them. For more information, see Microsoft’s Developer Network, https://msdn.microsoft.com/en-us/library/ms191188.aspx.
Prerequisites
To run this code sample, you must have system administrator privileges in SQL Server.
Steps
- Open SQL Server Management Studio.
- Run the EnableOleAutomationProcs.sql script.
Code Sample
EnableOleAutomationProcs.sql
-- Source: Microsoft® MSDN website, https://msdn.microsoft.com/en-us/library/ms191188.aspx
-- Description: A SQL Server batch that enables Ole Automation stored procedures in
-- SQL Server 2008 and higher.
-- Together with RECONFIGURE, enables advanced options so you can change their settings.
-- (Ole Automation is an advanced option.)
sp_configure 'show advanced options', 1
GO
RECONFIGURE;
GO
-- Together with RECONFIGURE, enables Ole Automation system procedures so you can
-- instantiate OLE objects within Transact-SQL batches.
sp_configure 'Ole Automation Procedures', 1
GO
RECONFIGURE;
GO
--Displays configured options so you can verify that Ole Automation Procedures is set to 1.
sp_configure 'show advanced options', 1