Groups | Blog | Home
all groups > sql server data mining > december 2006 >

sql server data mining : Error using OPENROWSET


larclap NO[at]SPAM yahoo.com
12/15/2006 12:40:19 AM
I have the following statement:

INSERT INTO MailHouse2.dbo.ClientUseCode
(ClientID, CountyFips, UseCode)
SELECT *
FROM OPENROWSET('SQLOLEDB.1','Provider=sqloledb.1;Data
Source=(localhost);Initial Catalog=MailHouse;uid=uid;pwd=pwd;',
'select 1 as ClientID,u.countyfipsid as CountyFips, u.usecodeid as
UseCode
from usecode u
inner join univusecodemap m on u.usecodepk=m.usecodefk
inner join compusecode c on u.usecodeid=c.usecode')

I know the inner select works because I've run it on the Mailhouse
(SQL2000) instance. However, when I run the entire query above from the
MailHouse2 (SQL2005) instance, I get the following error:

OLE DB provider "SQLNCLI" for linked server "(null)" returned message
"Deferred prepare could not be completed.".

Can someone help PLEASE?
Dejan Sarka
12/15/2006 6:03:05 PM
By default, SQL Server does not allow ad hoc distributed queries using
OPENROWSET and OPENDATASOURCE against providers other than the SQL Native
Client OLE DB Provider. You can allow this with a new sp_configure option.
Check the "Ad Hoc Distributed Queries Option" topic in Books OnLine.

--
Dejan Sarka
http://www.solidqualitylearning.com/blogs/

[quoted text, click to view]

AlterEgo
1/5/2007 1:30:43 PM
larclap,

Sometimes (localhost) causes issues when using at different OSI layers. Try
using the instance name.

-- Bill
[quoted text, click to view]

DM
1/10/2007 1:18:37 AM

In the query that you use in the Openrowset function, wherever you refer
tables of the other server, use the 3 part naming convention
(databasename.owner/schema.tablename)

DM

anonymous_user NO[at]SPAM sqlserverdatamining.com
1/10/2007 9:40:07 AM
[quoted text, click to view]
AddThis Social Bookmark Button