Split row into Multiple Rows in stored procedure in sql server 2008 -
i want split rows multiple rows based on value of column.for example if have working hrs 1 8 in 1 row want split in 2 rows 1 one 4 , other 4 8
table follows- hrs end name class 1 8 s 3
i want divide like
hrs end name class 1 4 s 1 4 8 s 2
please reply
you can use following concept split 1 row 2 rows
select 1 hrs, 4 end , name, 1 class thetable class=3 union select 4 hrs, 8 end, name, 2 class thetable class=3
of course need parameterize class , other values.
Comments
Post a Comment