CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 1999
    Location
    USA
    Posts
    101

    copy contents from databases

    I use 'insert into table1 select * from table2' to copy contents from one table to another when they are in the same database.

    But how do I do that if the tables are in different databases. I am using ADO's in VB. Do I need to open both the databases and then use the statement?

    Thanks


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: copy contents from databases

    it probably depends on your backend.
    If your database is SQLServer you do not need to open both databases. Just open the target database and issue a statement like
    insert into table1 select * from database.owner.tablename
    you can even use the following syntax to insert from another server
    insert into table1 exec server.database.owner.spName


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured