insert data from temporary table to existing table in SQL

insert into csei1 (studid,internal1,subject)

 SELECT internal1 FROM (SELECT studid, AC ,ASP ,DC , DSP,VLSI,CMC FROM i1)T UNPIVOT ( internal1 FOR N IN (AC ,ASP ,DC , DSP,VLSI,CMC))p

 

Here,

  1.  csei1 is table with columns studid , internal1 , subject
  2. We are selecting studid , AC ,ASP ,DC , DSP,VLSI,CMC FROM i1 table
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s