Unix Technical Forum

OpenQuery

This is a discussion on OpenQuery within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> I wish to send dynamic SQL to Openquery but it seems OpenQUERY only accepts string constants. Any advise on ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > MS SQL ODBC

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 09:46 PM
=?Utf-8?B?VGltb3RoeSBQZWVy?=
 
Posts: n/a
Default 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 Pee
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 09:47 PM
Sue Hoegemeier
 
Posts: n/a
Default Re: OpenQuery

If 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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:05 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com