Home » Blog » Topic » Move table form one database to another database in SQL

Move table form one database to another database in SQL

Stephen West ~ Modified: November 23rd, 2015 ~ ~ 1 Minute Reading

Home Forums Move table form one database to another database in SQL

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #915 Score: 0
    Stephen West
    Moderator
    4 pts

    I have two database database_1 and database_2. I have a table called m_table in database_1 that I want to move to database_2. How can I do this?

    #917 Score: 0
    Andrew Jackson
    Moderator
    1 pt

    Try this:

    SELECT * 
    INTO DestinationDB..MyDestinationTable 
    FROM SourceDB..MySourceTable 

    It will not copy constraints, defaults or indexes.

    #918 Score: 0
    Lincoln Burrows
    Moderator
    16 pts

    Use Generate SQL Server Scripts Wizard to help guide the creation of SQL script’s that can:

    • copy the table schema
    • any constraints (identity, default values, etc)
    • data within the table
    • and many other options

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.