locked
Transfer data from one table to another RRS feed

  • Question

  • User1983249378 posted

    there is a pretty nice method available to Transfer data from one table to another

    Transfer data from existing table to new Table :

    select * into table2 from table1

    Copy all data from table1 into table2 ( it creates new table2 no need to write Create statement )

    It will create new table2 and transfer all data from table1 to table2

    Transfer data from existing table1 to existing table2 :

    If u want to transfer data from one table to existing table2 then use

    Insert into vt_FE_Role1
    Select [Role] from vt_FE_Role
    donot include primarykey column if it is set as identity . otherwise you can use it. 
    You must take care of RDBMS if exists
    Thursday, May 26, 2011 3:05 AM

All replies

  • User-142667041 posted

    What to do if you want to copy with primary key (using indentity) ?

    Thanks

    Mike

    esoftcoder.com

    Thursday, August 18, 2011 11:50 AM
  • User1983249378 posted

    Just do one simple thing. Switch off Primary key constraint on both tables use above query then switch On identity.

    Most of data trasformation tools (SQL Belt etc) use this first disable all constraints then apply same constraints

    Saturday, August 20, 2011 6:18 AM