insert data from one table to another

后端 未结 2 974
别跟我提以往
别跟我提以往 2021-01-26 19:09

I have 2 different tables but the columns are named slightly differently. I want to take information from 1 table and put it into the other table. I need the info from table 1 p

相关标签:
2条回答
  • 2021-01-26 19:31

    This should work. You don't need to worry about the identify field in Table2.

    INSERT INTO Table2
     (client_last_name, client_first_name, taskDescription, category)
     (SELECT clientLastName, clientFirstName, incidentDescription, category
      FROM Table1
      WHERE info_field IS NOT NULL)
    
    0 讨论(0)
  • 2021-01-26 19:44
    Member_ID nvarchar(255) primary key,
    Name nvarchar(255),
    Address nvarchar(255)
    )
    insert into Member(Member_ID,Name,Address) (select m.Member_Id,m.Name,m.Address from library_Member m WHERE Member_Id IS NOT NULL)
    
    0 讨论(0)
提交回复
热议问题