Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Inserting data from one table to another

    • 0
    • 2
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 388
    Comment on it

    Inserting Data from one database table to different Database table.

    we can insert or copy data from one database table to another table of different database in SQL Server 2008 using following query keeping one thing in mind that the datatype of columns in both the tables should be same.

    INSERT INTO DataBaseB.dbo.Table2 (column1, column2) SELECT column1, column2 from DatabaseA.dbo.Table2 
    

    Inserting Data in same database.

    We can copy all columns from one table to another, existing table use below query:

    INSERT INTO table2 SELECT * FROM table1;
    

    Or we can copy only the columns we want to into another table, from existing table with the help of below query:

    INSERT INTO table2 (columnname(s)) SELECT columnname(s) FROM table1;
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: