Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check to see if a table exists without knowing its locat
Message
From
04/05/2005 15:33:07
 
 
To
04/05/2005 15:26:54
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01010987
Message ID:
01011007
Views:
22
I want to determine if the file (which is not opened yet) but can be opened with:

use dbprofiler!mytable

actually exists on the hard drive before attempting to open it.

This is probably a silly question that cannot be done at all unless you know the path to data files. I normally do know the path and that value is stored is a relative path like "..\data\" and stored in a variable like 'ddir' or something. The we check for the existence of the table using:

IF FILE (ddir+'mytable.dbf')
*open the table
ELSE
*create the table or present an error message, etc.
ENDIF

But we are trying to remove all references to paths in our apps and only reference the tables by their database such as dbProfiler!mytable but that will not work when checking for the existence of the table...

>If you do a DBF() on a view or a cursor that isn't actually a disk based table, you'll get a filename that ends in '.tmp' rather than '.dbf'. Does that help at all?
>
>>If I have a database: dbWorkFiles
>>
>>and I want to determine if one of its tables physically exist I would typically store a common path to the data directory to a variable like 'ddir' and then do:
>>
>>IF FILE (ddir+'mytable.dbf')
>>
>>However, if I do not know exactly where the tables are located - lets say I open them with:
>>
>>use dbWorkFiles!mytable
>>
>>then how can I check to see if the table exists or not if I do not know where they are located? Is that possible? It could be a part of the database but not physically exist...
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform