I have two SQL Server databases with the same table. One of the tables gets updated by the user. How can I copy the updated table to the table in the other database when a user clicks on a VB cmd button "update table".
Thanks for your help.
Printable View
I have two SQL Server databases with the same table. One of the tables gets updated by the user. How can I copy the updated table to the table in the other database when a user clicks on a VB cmd button "update table".
Thanks for your help.
Execute the following SQL
sSQL = "insert into db2.dbo.table2 select * from db1.dbo.table1"
conn.Execute sSQL
Iouri Boutchkine
[email protected]
Iouri,
Will this code append to the existing rows or replace all the rows? I need to replace all existing rows. Essentially, I want to re-create the table.
Thanks!
Re-create? Then you can drop all from first table, and after that insert form the second.
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
It will append rows. As Cimperiali said you can delete records from the table and then append.
Iouri Boutchkine
[email protected]