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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy View From DBC-1 to DBC-2

Status
Not open for further replies.

JRB-Bldr

Programmer
May 17, 2001
3,281
US
I saw that Tamar had a tutorial on Copying a View from one DBC to another DBC posted on the web, but that link is no longer available.

And I did not find it in my Tek-Tips search.

Therefore, without anything else to refer to, can anyone tell me how to Copy a View from one DBC to a different one?

Thanks,
JRB-Bldr
 
You can save View script to a file and run it against different database. If you use View Editor by Steve Saywer, then it has this functionality, otherwise one of the ways would be to use GenDBC utility to get view script.
 
I don't remember having such a tutorial, but you should be able to do something using DBGetProp() to retrieve the view's settings and then use CREATE VIEW and DBSetProp() to create the new view.

Tamar
 
Hello Tamar,

If you do a Google search for
"copy view" vfp
your previous article/tutorial pops up as the first find.

It's URL used to be:
But it is a "dead end" link now.

Everyone - thanks for the suggestions.
I have a new remote system to add and I need to copy quite a few of the existing Views into a new system-specific database. A "short-cut" would have been convenient, but I can always do it the "hard way".

Thanks,
JRB-Bldr
 
JRB-Bldr,

I haven't tested this, but you should be able to do something like the following:

Code:
SET DATABASE TO SourceDBC
lcSQL = DBGETPROP("MyView","VIEW","SQL")
SET DATABASE TO TargetDBC
CREATE SQL VIEW MyView &lcSQL

That would create the basic view. You could then use a similar technique if you need to copy any of the properties, such as the update criteria.

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
To copy the view, markros already pointed out some tools, eView (UT Download) is another one. Perhaps the easiest way would be copying the whole DBC, then dropping the tables and views you don't need in that copied DBC.

Bye, Olaf.
 
One other suggestion is to use the View SQL code window.
-Open the view in the view designer, right click on the data table section and select "View SQL" from the shortcut menu.
-Copy all the code from the resulting code window.
-Go to the target database.
-Open the view designer and select "New Local View" from the same shortcut menu.
-Close the resulting "Add a Table or View" dialog.
-Open the "View SQL" code window in View Designer of the target database. (It will be empty)
-Paste your code and save the view.

pamela
 
JRB-Bldr:

Keep it simple, Use Pamelas suggestion...short and effective... Just make sure in the SQL code you change the name of the database to that of the new one...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top