LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I copy recordsets from one database table to another?

I am using the Database Connectivity Toolset, and would like to copy either one recordset or multiple recordsets from one Access table to a table in a different database. I would like to do it directly with the data in variant form, but I can't get it to work. I can get it to work(on a small test table) if I first convert my source variant data to a cluster, then insert that into the other database table. My real database has many items with a variety of date types. Can I copy directly variant to variant?
0 Kudos
Message 1 of 5
(3,436 Views)
Brian,

I may have an example that I have been working on that does what you need.

Like I said though, this is a work in progress and has not been cleaned up and documented. So any feedback you have will be useful in getting the VI better for more customers. Once I get it all cleaned up I will post it in the Example Program Database. Until then here it is.

Evan
National Instruments
0 Kudos
Message 2 of 5
(3,436 Views)
Is it necessary to read all the data back into LabVIEW first? The reason I'm asking is that it is much more efficient to just use SQL statements to get the data you need and write that directly to the second database. I did a quick Google search on it and came up with lots of responses on what the correct syntax is for setting that up. Using an SQL command to copy the data back and forth is analogous to copying data from one file to another using the Copy file function rather than reading the entire contents of the file, converting the file string to the data arrays, converting back to a string, and then writing it back to another file.

Chapter 5 of the Database Connectivity Toolset User Manual describes how to execute SQL queries.

If you do need to actually
see the data in LabVIEW first, then the only way to get it back into the other database is to convert those variants to LV datatypes and then cluster those values again and write them back out to the second database.
0 Kudos
Message 3 of 5
(3,436 Views)
Crystal-

I do not need to view the data in Labview. I have used SQL statements quite a bit, but never between 2 databases. I will try this method, since it seems like it would be the easiest way to go.

Thanks
0 Kudos
Message 4 of 5
(3,436 Views)
Evan,

Thank you for your answer and your example.

I am using LabView6 now, so I can not read your example.
Would you please convert it into LabView6?

Thank you,
Hiep
0 Kudos
Message 5 of 5
(3,436 Views)