Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I HATE OpenQuery!
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01548093
Message ID:
01548108
Views:
61
AFAIK OpenQuery does not work with a variables as parameters, you need to create the string inside the function call, ie

set @SQL = 'SELECT * FROM TABLE'
select * from OpenQuery(ORACLE, @SQL) -> Fail
select * from OpenQuery(ORACLE, 'SELECT * FROM TABLE') -> Works

IOW, you need to build your complex string inside the function call



[UPDATE] Ah, I did not see you were using EXEC... then what I said does not apply, but I never tried either...
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform