3

I have an empty SQL table with the following Design: table1

MsgName_ID      bigint   
MsgName_Type    nvarchar(10)     
MsgName_CurID   nvarchar(100)    
MsgName_Name    nvarchar(50)     
MsgName_Meaning nvarchar(1000)    
MsgName_Note    varchar(50)  
MsgName_Gender  varchar(10)  
MsgName_Origin  nvarchar(100)     
MsgName_Active  bit  
MsgName_Created datetime

and another full table with the following design: table2

Name    nvarchar(255)
Meaning nvarchar(255)
Gender  nvarchar(255)   
Origin  nvarchar(255)     

I want to fill the empty table with Table1.MsgName_Name= Table2.Name , Table1.MsgName_Meaning=Table2.Meaning , table1.MsgName_Gender=Table2.Gender , table1.MsgName_Origin=table2.Origin

All the other fields have a default value.

What is the easiest way to do this?

Any help would be appreciated

HelpASisterOut
  • 3,085
  • 16
  • 45
  • 89

1 Answers1

7

How about this?

Insert into table1 (MsgName_Name,MsgName_Meaning,MsgName_Gender,MsgName_Origin)
Select Name,Meaning,Gender,Origin from table2
harshit
  • 3,788
  • 3
  • 31
  • 54