Split row into multiple rows in SQL Server for insert -


i trying create sql query insert single row 2 rows in table.

my data looks this:

size | indemnity_factor | monitoring_factor --------------------------------------------     0    | 1.00             | 1.5  

the end data looks this:

id | claim_component_type_code | size | adjustment_factor | valid_from_date ------------------------------------------------------------------------------     1  | indemnity                 | 0    | 2.5000000         | 2014-01-01 1  | monitoring                | 1    | 1.5000000         | 2014-01-01 

i want add entry of indemnity , monitoring every row in first data source. haven't got idea how go it, appreciative if help. sorry rough data can't post images reputation apparently.

thanks in advance.

use unpivot

select *  (select size, indemnity_factor indemnity, monitoring_factor monitoring       yourtable) src unpivot (adjustment_factor claim_component_type_code in (indemnity, monitoring) ) u 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -