Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi-Database Remote View

Status
Not open for further replies.

SGLong

Programmer
Jun 6, 2000
405
0
0
US
Is it possible to create a remote view in VFP that draws information from two SQL-Server databases on two separate servers (with two separate connection strings)?

Steve

 
Well, you could create 2 views, one from each server, and then a third view based on the first 2, but I can't imagine how you'd ever update such a thing.

Regards,
Jim
 
Updating multi-table views CAN be done, but it's every bit as much work (more, actually) as updating two different views. <s>

You have to send two updates. First you set Updateable, UpdateFieldsList, etc., for one of the underlying tables and sende that update, then you turn those off and turn on the fields for the other table and then send that update.

The ONLY value to this is being able to manually put the whole shooting match into a single transaction on the back end, but since this thread is about data on more than one server even that goes out the window.
 
Mike,

I agree with you, and it's not my plan to make this an updateable view --- I just want to be able to access the data for display / reporting purposes without having to jump thru hoops each time I need it.

Steve
 
You would be better off creating a Sql Server view on one of the server that accesses both tabes. The one on the other server using a linked server connection. Then create a VFP view on the SQL Server view.
 
Steve,

What you want to is not only perfectly possible, but not all that unusual. Here's how you would do it (this is off the top of my head and not tested):

Code:
CREATE SQL VIEW MyView CONNECTION MyConnection ;
  AS SELECT * FROM FirstServer.MyDatabase.dbo.MyTable ;
  JOIN SecondServer.MyOtherDatabase.dbo.MyOtherTable ;
  ON <condition> ;
  WHERE <condition>

Of course, this assumes that you have the necessary permissions to access both databases.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike,

I think the problem here is he has a separate connection string for each database.

Regards,
Jim
 

Jim,

I think the problem here is he has a separate connection string for each database.

Ah, yes, I see that now.

But I wonder if he needs two connection strings. I would've thought that, provided he has a connection to the first server, and that server can see the second server, all would be well. Assuming, also, that the user is authenticated for both servers. But I might be totally wrong about that.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike & Jim

I've been playing around with various ways of the "CREATE SQL..." command that Mike suggested without success. I think that fluteplr had the right idea - make a view in SQL that links the two sets of files and then have a VFP view of that view. Thanks for the suggestions. I'll keep you posted.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top