Conrad (ca*@digitalinc.net) writes:
Thnak you for your quick response. Your workaround works but I have now
hit anther limit the openquery method only allows fro a 128 char string.
This is ok for simple queries but some of the queries are approx 180
characters.
That seems strange. I can't find any such limitation, and I tried this
statement without problem:
SET QUOTED_IDENTIFIER OFF
go
SELECT * FROM OPENQUERY(REMOTSRV,
"SELECT o.OrderID, o.OrderDate, od.UnitPrice, od.Quantity,
c.CustomerID, c.CompanyName, c.Address, c.City, c.Region,
c.PostalCode, c.Country, c.Phone, p.ProductID,
p.ProductName, p.UnitsInStock, p.UnitsOnOrder
FROM Northwind..Orders o
JOIN Northwind..[Order Details] od ON o.OrderID = od.OrderID
JOIN Northwind..Customers c ON o.CustomerID = c.CustomerID
JOIN Northwind..Products p ON p.ProductID = od.ProductID
WHERE (o.OrderDate >= '19960101')
AND (o.OrderDate <= '19990601')
AND (od.UnitPrice >= 10)
AND (od.UnitPrice <= 100)
AND (o.CustomerID = 'ALFKI')
AND (c.CompanyName LIKE 'Alfred' + '%')
AND (c.City = 'Berlin')
AND (c.Region IS NULL)
AND (c.Country = 'Germany')
AND (od.ProductID = 76)
AND (p.ProductName LIKE 'Lakka' + '%')
ORDER BY o.OrderID")
I tried with both MSDASQL and SOLOLEDB.
I will however research if there is some workaround that permits you
to access the remote database without specifying the database name.
--
Erland Sommarskog, SQL Server MVP,
so****@algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp