Why is using OPENQUERY on a local server bad?
Posted
by Ziplin
on Stack Overflow
See other posts from Stack Overflow
or by Ziplin
Published on 2010-03-03T20:37:07Z
Indexed on
2010/03/07
23:11 UTC
Read the original article
Hit count: 417
I'm writing a script that is supposed to run around a bunch of servers and select a bunch of data out of them, including the local server. The SQL needed to SELECT the data I need is pretty complicated, so I'm writing sort of an ad-hoc view, and using an OPENQUERY statement to get the data, so ultimately I end up looping over a statement like this:
exec('INSERT INTO tabl SELECT * FROM OPENQUERY(@Server, @AdHocView)')
However, I've heard that using OPENQUERY on the local server is frowned upon. Could someone elaborate as to why?
© Stack Overflow or respective owner