Wednesday, March 28, 2012

OpenQuery

I wish to send dynamic SQL to Openquery but it seems OpenQUERY only accepts
string constants. Any advise on how to do this. It would convenient if
Openquery could execute similar to dynamic SQL EXEC.
Please advise.
Regards,
Tim PeeIf you need it to be dynamic, you can build the entire
string that does the Openquery statement. Pass that string
into an EXEC. You can find examples in the following
article:
HOW TO: Pass a Variable to a Linked Server Query
http://support.microsoft.com/?id=314520
-Sue
On Thu, 23 Jun 2005 21:34:04 -0700, Timothy Peer
<TimothyPeer@.discussions.microsoft.com> wrote:

>I wish to send dynamic SQL to Openquery but it seems OpenQUERY only accepts
>string constants. Any advise on how to do this. It would convenient if
>Openquery could execute similar to dynamic SQL EXEC.
>Please advise.
>Regards,
>Tim Pee

No comments:

Post a Comment