Discussion:
Copying views from one db to another
(too old to reply)
Stefan Wuebbe
2004-08-30 13:24:42 UTC
Permalink
Ken,

You can use "gendbc.prg" in the Vfp Home() folder and
run it to get a result.prg containing your view definitions.


hth
-Stefan
How do i copy views from one db to another db., i created these views(they
are very complex) in command window now when i try to modify them using
designer it says the view is too complex to be edited and unfortunately i
dont have the text file of the view so i cant recreate it. Is there any way
just to copy these views from one db to another db.
The only reason i want to do is i built a system a while ago and since then
there have been new tables/data in the system and i want to migrate these
views to the new db without any recent data loss. thanks in advance.
-Ken
Lee Mitchell
2004-08-30 13:41:34 UTC
Permalink
Hi Ken:

Try using GenDBC and see if it does what you need. See 174807 How To Edit
the SQL Statement of a Remote or Local View
http://support.microsoft.com/?id=174807

You might also want to look at Gendbc_m available on Universalthread.com.
Go to www.universalthread.com, click on the Download icon, and choose
Visual FoxPro as the product. In the Summary text box of the query page,
search for "Gendbc_m".


I hope this helps.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP9 Public Beta Now Available!! --*
Download the VFP9 beta here: http://msdn.microsoft.com/vfoxpro/

*-- VFP8 HAS ARRIVED!! --*
Read about all the new features of VFP8 here:
http://www.universalthread.com/VisualFoxPro/News/VFP8Release.asp
Purchase VFP8 here:
http://shop.microsoft.com/Referral/Productinfo.asp?siteID=11518

Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retired Sept. 30th, 2003
How do i copy views from one db to another db., i created these views(they
are very complex) in command window now when i try to modify them using
designer it says the view is too complex to be edited and unfortunately i
dont have the text file of the view so i cant recreate it. Is there any
way
just to copy these views from one db to another db.
The only reason i want to do is i built a system a while ago and since
then
there have been new tables/data in the system and i want to migrate these
views to the new db without any recent data loss. thanks in advance.
-Ken
Anders Altberg
2004-08-30 20:54:05 UTC
Permalink
A view query can be extracted with
OPEN DATABASE x
DBGETPROP('myview', 'VIEW', 'SQL')
If you can excute the view and get a cursor you can get the SQL with
_ClipText= CURSORGETPROP('SQL')
and paste the query into a program widow.
-Anders
How do i copy views from one db to another db., i created these views(they
are very complex) in command window now when i try to modify them using
designer it says the view is too complex to be edited and unfortunately i
dont have the text file of the view so i cant recreate it. Is there any
way
just to copy these views from one db to another db.
The only reason i want to do is i built a system a while ago and since
then
there have been new tables/data in the system and i want to migrate these
views to the new db without any recent data loss. thanks in advance.
-Ken
Stefan Wuebbe
2004-08-31 03:14:44 UTC
Permalink
Post by Stefan Wuebbe
Ken,
You can use "gendbc.prg" in the Vfp Home() folder and
run it to get a result.prg containing your view definitions.
Thank you Stefan for your reply, I am a newbie can you please explain in a
more detailed manner...thank you in advance.
You can run it from the command window
DO HOME() + 'tools\gendbc\gendbc.prg'

Then gendbc wants to know which database.DBC it should
analyze and where to put the results.PRG
Afterwards, you can have a look at the result, say you named
it "results.prg":
Modify Command results.prg

... and search Ctrl+F for your view name(s).
The view definition is one CREATE VIEW line plus a bunch
of DbSetProp() statements setting the view / field's properties,
like "SendUpdates", "KeyField", "Tables" etc.

Running the "results.prg" as it is would give you an entire new
(empty) database if you want.
If you just copy and run those lines related to your particular
view, you can re-create the view only, say in another database
container
Create Database yourNew.dbc
Create View ...
DbSetProp(...


hth
-Stefan

Loading...