Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 OPENROWSET error

Author  Topic 

Ads
Starting Member

23 Posts

Posted - 2012-02-15 : 06:41:11
Hi,

I'm trying to run the following OPENROWSET code on the local server, however it asks for ad hoc to be turend on? I have tried this but it seems to be only needed for a remote server?

<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="true"
' Catalog=""
' Schema=""

Dim ActinicPersonsNew, ActinicOrdersNew, ActinicOrderLinesNew, ActinicPaymentsNew
ActinicPersonsNew = "OpenRowset('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)}; DefaultDir=C:\Inetpub\Actinic Order Files\;','select * FROM persons.csv')"
ActinicOrdersNew = "OpenRowset('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)}; DefaultDir=C:\Inetpub\Actinic Order Files\;','select * FROM orders.csv')"
ActinicOrderLinesNew = "OpenRowset('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)}; DefaultDir=C:\Inetpub\Actinic Order Files\;','select * FROM orderlines.csv')"
ActinicPaymentsNew = "OpenRowset('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)}; DefaultDir=C:\Inetpub\Actinic Order Files\;','select * FROM payments.csv')"
%>

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-15 : 09:33:59
Openrowset is a adhoc type of distributed query for using it you need to turn on adhoc distributed queries in the server.
what does below return?



EXEC sp_configure 'show advanced option', '1';
GO
EXEC sp_configure 'ad hoc distributed queries'


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Ads
Starting Member

23 Posts

Posted - 2012-02-15 : 11:42:32
When ad-hoc is turned on, the page in question returns a HTTP 500 error?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-15 : 14:56:05
quote:
Originally posted by Ads

When ad-hoc is turned on, the page in question returns a HTTP 500 error?


catch the error and see what exactly is the error message

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Ads
Starting Member

23 Posts

Posted - 2012-02-16 : 04:06:38
This is the error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Ad hoc access to OLE DB provider 'MSDASQL' has been denied. You must access this provider through a linked server.

/Sales/quasar_order_list.asp, line 57
Go to Top of Page
   

- Advertisement -