Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Unanswered: How to insert all info from a table of database to onther table of other database?

    I have two database and both of them has the same table, i want to copy all info from this first table to the secornd table

    For Example:
    Database : DB_1, table is table_1
    Database : DB_2, table is table_2

    both table_1 and table_2 have the same struct

    how can i insert all records from table_1 to table_2

    thanks

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    You can use DTS by using wizard from enterprise manager, if its one-off option.
    Otherwise schedule that package as a job oto execute in periodic basis.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

  3. #3
    Join Date
    Jan 2003
    Location
    India
    Posts
    523
    if it is just one table and one time affair, then u can just import the data from EM using the import wizard.

  4. #4
    Join Date
    Mar 2004
    Posts
    2

    Thanks but i do it by programming SQL or C# language

    can you show me in programming

  5. #5
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    Use a SELECT subquery to specify the data values for one or more rows.
    INSERT INTO MyTable (PriKey, Description)
    SELECT ForeignKey, Description
    FROM SomeView



    And review information from SQL books online.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

Posting Permissions

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