troubleshooting Question

Openquery to Oracle in execute

Avatar of miral13
miral13 asked on
Microsoft SQL ServerEnterprise Software
2 Comments1 Solution672 ViewsLast Modified:
I am trying to run an openquery via an oracle linked server but I get this error:
'Could not find stored procedure 'select * from openquery(UKORACLE, ''select  to_char(ID) as ID from VW_DATA'')'

If I execute the query without putting it in an execute then it works.


declare @sql as varchar(4000)
set @sql = '
select *
from openquery(UKORACLE, ''select
    to_char(ID) as ID
	from VW_DATA'')'
exec @sql
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros