Try
lcTable = "xxtemp.dbf"
IF FILE(lcTable)
SELECT 0
USE (lcTable)
IF NOT EMPTY(CURSORGETPROP("Database"))
USE
DROP TABLE (lcTable)
ENDIF
ENDIF
BTW, can you use a cursor instead of table? It can have long field names also.
>I occasionally want to copy the structure from an SQL table to a temporary DBF file on my hard disk. I use a DBC because the SQL table has long field names.
>
>The easy way is
>Open database SQL_views
>Use sql_data_file nodata
>Copy stru to xxtemp database tempwork
>
>PROBLEM is that xxtemp.dbf might exist and might be part of a different dbc.
>
>So I can not just erase xxtemp.dbf and I can not open tempwork.dbc and delete xxtemp because it may be part of another DBC.
>
>Even after I have erased xxtemp.DBF and erased the DBC (tempwork.*), it STILL says that xxtemp.dbf already exists as part of a database.
>
>How can I overwrite file xxtemp.dbf and remove it from whatever DBC it is attached to?
>
>How do I know what DBC that a given dbf is attached to (or not attached)?
--sb--