Copying tables shouldnt be hard! 
Author Message
 Copying tables shouldnt be hard!

But it is!
I want to copy a table within a database. Ie given Table1 i want
Table2 to be identical. Even `metadata` (think its called that) such
as the index, caption, allow zero length etc fields. Is this possible?
I dont want to use the DoCmd.TransferDatabase or whatever methods, as
this implies Access will be installed on the target machine, and this
is not the case. So it has to be SQL commands, and/or VB code.

Any ideas? I`m not bothered about maintaining links to other tables,
as in my case there arent any (although i guess i may want to do this
someday).



Fri, 16 Apr 2004 20:12:51 GMT  
 Copying tables shouldnt be hard!

Quote:
>But it is!
>I want to copy a table within a database. Ie given Table1 i want
>Table2 to be identical. Even `metadata` (think its called that) such
>as the index, caption, allow zero length etc fields. Is this possible?
>I dont want to use the DoCmd.TransferDatabase or whatever methods, as
>this implies Access will be installed on the target machine, and this
>is not the case. So it has to be SQL commands, and/or VB code.

It will HAVE to be VB code. JetSQL DDL does not set all of these
properties you mention, some of which are Access-defined properties.
You are going to have to use DAO code to get at all of these
properties - ADOX still lacks sufficient hooks to get at and set all
of them, expecially if you're talking about an A97 database. There is
a program out there called MDB2BAS which you can find via a web
search. It generates a module which contains all the procedures needed
to create a duplicate table. I think there are also similar tools
available at the Access Web <www/mvps.org/access> or at Tony Toew's
site <http://www.granite.ab.ca/accsmstr.htm>

HTH,
Bob Barrows
Please reply to the newsgroup. My reply-to address is my "spam trap" and I don't check it very often.



Fri, 16 Apr 2004 20:45:21 GMT  
 Copying tables shouldnt be hard!
Yes, it is possible with SQL!
Look in your docs for create table and create index.
It's all there.

--



Quote:
> But it is!
> I want to copy a table within a database. Ie given Table1 i want
> Table2 to be identical. Even `metadata` (think its called that) such
> as the index, caption, allow zero length etc fields. Is this possible?
> I dont want to use the DoCmd.TransferDatabase or whatever methods, as
> this implies Access will be installed on the target machine, and this
> is not the case. So it has to be SQL commands, and/or VB code.

> Any ideas? I`m not bothered about maintaining links to other tables,
> as in my case there arent any (although i guess i may want to do this
> someday).



Sat, 17 Apr 2004 02:37:57 GMT  
 Copying tables shouldnt be hard!

Quote:

>Yes, it is possible with SQL!
>Look in your docs for create table and create index.
>It's all there.

Umm - how about AllowZeroLength, or Caption, or Description .... try
to find these properties in the JetSQL reference ... you won't. Oh -
and before you bring it up, setting as field to NOT NULL is not the
same as setting AllowZeroLength to False.


Sat, 17 Apr 2004 09:41:05 GMT  
 Copying tables shouldnt be hard!

Quote:
> Yes, it is possible with SQL!
> Look in your docs for create table and create index.
> It's all there.

I just want to copy the whole table unchanged. I`m not really
interested in specific properties. Either its possible in one
operation, or there must be some way of reading/writing *all* the
properties. It must be possible - you can copy a table from within
Access in a couple of seconds using the GUI ( you can rename tables
too - perhaps this is handled in exactly the same way).


Sat, 17 Apr 2004 17:43:33 GMT  
 Copying tables shouldnt be hard!

Hi Alex

There is an article about copying a table in MS Support site.
The address is :
http://support.microsoft.com/support/kb/articles/Q217/0/11.ASP
Full source code is also included in the page.
I think it is what you are looking for.

Serdar Aytamaner


Quote:


> >Yes, it is possible with SQL!
> >Look in your docs for create table and create index.
> >It's all there.

> Umm - how about AllowZeroLength, or Caption, or Description .... try
> to find these properties in the JetSQL reference ... you won't. Oh -
> and before you bring it up, setting as field to NOT NULL is not the
> same as setting AllowZeroLength to False.


> > >But it is!
> > >I want to copy a table within a database. Ie given Table1
> > >i want Table2 to be identical. Even `metadata` (think its called
> > >that) such as the index, caption, allow zero length etc fields.
> > >Is this possible?
> > >I dont want to use the DoCmd.TransferDatabase or whatever
> > >methods, as this implies Access will be installed on the target
> > >machine, and this is not the case. So it has to be SQL commands,
> > >and/or VB code.
> > >Any ideas? I`m not bothered about maintaining links to other
> > >tables, as in my case there arent any (although i guess i may
> > >want to do this someday).



Sat, 17 Apr 2004 17:18:35 GMT  
 Copying tables shouldnt be hard!

Quote:


>> Yes, it is possible with SQL!
>> Look in your docs for create table and create index.
>> It's all there.

>I just want to copy the whole table unchanged. I`m not really
>interested in specific properties. Either its possible in one
>operation, or there must be some way of reading/writing *all* the
>properties. It must be possible - you can copy a table from within
>Access in a couple of seconds using the GUI ( you can rename tables
>too - perhaps this is handled in exactly the same way).

You should use DoCmd.copyObject to get that functionality. This
solution, however, requires Access to be running, either
interactively, or via Automation.

HTH,
Bob Barrows
Please reply to the newsgroup. My reply-to address is my "spam trap" and I don't check it very often.



Sat, 17 Apr 2004 20:27:17 GMT  
 Copying tables shouldnt be hard!

Quote:
> http://support.microsoft.com/support/kb/articles/Q217/0/11.ASP
> Full source code is also included in the page.
> I think it is what you are looking for.

Yes, that looks like it could be helpful. I just couldnt do it, so
have coded around the problem. But i will incorporate this into the
next version of my general purpose DB code!

Thank you!
alex.



Sun, 18 Apr 2004 23:31:37 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Shouldnt treeview node.tag take object...

2. Copy files from hard drive to Public Folders

3. Hard copy manual for Turbo Basic

4. Free 70+p hard copy developers mag

5. VB.Net using a Word doc object - copying in text w/ a hard return

6. Free 70+p hard copy developers mag

7. Detecting hard-copy printout from Report Viewer

8. Data not Appearing in the hard copy

9. Is VB5 documentation available in hard copy?

10. how hard to copy files based on age.

11. Crystal report: detecting when hard copy has printed

12. Copying DBGrid contents to clipboard (Or copying a table from a Data component to clipboard)

 

 
Powered by phpBB® Forum Software