dbTalk Databases Forums  

sort of OpenQuery

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss sort of OpenQuery in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
news.microsoft.com
 
Posts: n/a

Default sort of OpenQuery - 02-03-2005 , 01:16 PM






I'm trying to create a DTS to simulate the following - because of security I
cannot use linked servers - however I am allowed to query the servers via
DTS.

If I was allowed a linked server - my TSQL may look like this:

Select myVal
from server1.win.dbo.encase
where MyVal not in (select myVal from server2.win.dbo.encase)

My approach was:
-create two SQL connections, one to server1 and server2
-create a Execute SQL task to server one to retrieve a gvRS of MyVal from
Server1
-create a 2nd Execute SQL taks to return MyVal numbers from Server2 that
don't exist in the gvRS



Reply With Quote
  #2  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: sort of OpenQuery - 02-03-2005 , 01:43 PM






You can use Openrowset to the other data source instead of
linked servers. So the where clause would be something like:
WHEREMyVal not in
(SELECT *
FROM Openrowset('SQLOLEDB','server2';'user';'password',
'SELECT myVal FROM Encase'))

You may also want to consider using not exists instead of
not in.

-Sue

On Thu, 3 Feb 2005 11:16:32 -0800, "news.microsoft.com"
<joe (AT) msn (DOT) com> wrote:

Quote:
I'm trying to create a DTS to simulate the following - because of security I
cannot use linked servers - however I am allowed to query the servers via
DTS.

If I was allowed a linked server - my TSQL may look like this:

Select myVal
from server1.win.dbo.encase
where MyVal not in (select myVal from server2.win.dbo.encase)

My approach was:
-create two SQL connections, one to server1 and server2
-create a Execute SQL task to server one to retrieve a gvRS of MyVal from
Server1
-create a 2nd Execute SQL taks to return MyVal numbers from Server2 that
don't exist in the gvRS



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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.