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

Create new table from existing table

Status
Not open for further replies.

Elsje

Programmer
Feb 20, 2004
44
BE
Hi,

I have a table (dbf) and I need to create a new dbf but the structure has to be the same as the first table.
Is there a way to do this easily but the new table has to be empty, I don't need the records from the first table.

Thanks in advance.
 
How is this a VB.NET question? If it's SQL it would be something like

Code:
SELECT *
INTO Table2
FROM Table1
 
I don't know if it will work with DBase tables, but I do know you can run some SQL on them.

I use this with MS Sql to create empty tables (in this case temporary):
Code:
SELECT * INTO #newTableName FROM oldTableName WHERE 1 = 0
 
Borvik,

I want to create the new table and save it on a specified location.
But this table has the same structure (columns) as an other table, so I need to know if there is an easy way to copy the structure of this table to a new one.

Thanks
 
I'm not so sure about DBase, but that code above DOES work (in MSSQL) to create an table with the same structure without rows. Though I haven't tried this with a DBase table (my DBase experience is limited to importing data to MSSQL using .NET).

As for saving it in a specified location - that is another matter altogether and something outside my knowledge of DBase.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top