Copy a Table

  • Thread starter Thread starter Wayne Wengert
  • Start date Start date
W

Wayne Wengert

When a specific event occurs I want to make backup copies of 2 tables using
names like "BkupTbla081204.xml" and "BkupTblb081204.xml". What is the best
way to do this? I suspect there is some simple method that I have
overlooked.

Wayne
 
Wayne,
When a specific event occurs I want to make backup copies of 2 tables using
names like "BkupTbla081204.xml" and "BkupTblb081204.xml". What is the best
way to do this? I suspect there is some simple method that I have
overlooked.

Wayne
What do you want to know how to make the name or how to write the table,
however a complete solution?

dim myfilename as string = "BkupTbla" & Now.tostring(MMddyy) & ".xml"
myds.writeXML(myfilename)
myfilename = "BkupTblb" & Now.tostring(MMddyy) & ".xml"
myds.writeXML(myfilename)

Because of the current date and your sample I think you want the US date
notation and I have made it in that, for most other countries you have to
change the dd and the MM in the sample. (This is for when someone search on
this sample).

I hope this helps?

Cor
 
Cor;

Thanks for the response. The solution you offered creates a backup table
from the open dataset. I am looking for a way to make a copy of a table when
the contents of that table are not open in a dataset. I guess I could read
the table into a dataset and then write that out to a new table but I was
looking for some sort of simple table copy process?

Wayne
 
Wayne,

The same simplicity I assume you have an existing one you want to protect, a
good idea with a XML file. All typed in message so watch typos.

\\\
Dim myfilenameB as string = "BkupTblb" & Now.tostring(MMddyy) & ".xml"
dim myfilenameA as string = "BkupTbla" & Now.tostring(MMddyy) & ".xml"

if file.exist(myfilenameB) then
File.delete(myfilenameB)
end if
file.move(myfilenameA, myfilenameB)
file.copy(myoriginal, myfilenameA)
///
In this the B is deleted,it is up to you if you want that or to do something
else with it.

I hope this helps?.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top