By default Ad Hoc Distributed Queries are disabled on SQL server 2005
If you try to run OPENROWSET you will get this error message
Server: Msg 15281, Level 16, State 1, Line 1
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.
To enable it do this
EXECUTE sp_configure 'show advanced options', 1
RECONFIGURE WITH OVERRIDE
GO
EXECUTE sp_configure 'Ad Hoc Distributed Queries', '1'
RECONFIGURE WITH OVERRIDE
GO
EXECUTE sp_configure 'show advanced options', 0
RECONFIGURE WITH OVERRIDE
GO
Wednesday, May 16, 2007
Enable Ad Hoc Distributed Queries (OPENROWSET) On SQL Server 2005
Posted by Denis at 10:09 AM
Labels: OPENDATASOURCE, OPENROWSET, SQL Server 2005
Subscribe to:
Post Comments (Atom)
1 comment:
Thanks, that did it!
Post a Comment