Insert Data from One Table to Another Table in SQL Server

Two tables are given as :
 
Table1
 

CREATE TABLEtable1(

[date] [datetime] NULL,

[num] [varchar](50) NULL,

[status] [nvarchar](255) NULL,

[tid] [varchar](50) NULL

)

 

Table 2
 

CREATE TABLEtable2(

[date] [datetime] NULL,

[num] [varchar](50) NULL,

[status] [nvarchar](255) NULL,

[tid] [varchar](50) NULL,

[tname] [varchar](50) NULL,

)

Query to insert data from table2 to table1 as per your requirement in one shot.

 

INSERT INTO table1 ([date] ,[num] ,[status] ,[tid])

SELECT [date],[num],[status] ,[tid] FROM table2 where num > 100

Ebook Download
View all
Learn
View all