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
 General SQL Server Forums
 New to SQL Server Programming
 Help with Openquery statement

Author  Topic 

Sarakumar
Posting Yak Master

108 Posts

Posted - 2009-06-11 : 05:25:37
hai,
i have statement like this,

SELECT * FROM OPENQUERY(siebel,'SELECT cust.cid,cust.cname from siebel.custmoer cust where cust.city=''uk''
union
SELECT cust.cid,cust.cname from siebel.custmoer cust where cust.city=''IN''')

the Above query works fine, but when i try to use the bracket for the query, it gives me the error
object has no columnsProviderName sql server...bla bla error..

ERROR query


SELECT * FROM OPENQUERY(siebel,'(SELECT cust.cid,cust.cname from siebel.custmoer cust where cust.city=''uk'')
union
(SELECT cust.cid,cust.cname from siebel.custmoer cust where cust.city=''IN'')'

help me on this query to place the bracket in the right place,

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-06-11 : 05:42:57
what are you wanting the extra brackets for? they don't do anything syntactically.

Saying that, you are missing a closing bracket in the second example at the end

SELECT * FROM OPENQUERY(siebel,'(SELECT cust.cid,cust.cname from siebel.custmoer cust where cust.city=''uk'')
union
(SELECT cust.cid,cust.cname from siebel.custmoer cust where cust.city=''IN'')')




Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -