Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Split Record by Field into Multiple Records

$
0
0
Hello all,I have a table that I need to split up the records into multiple records by and Integer field. Here is what the table is like and what it should look like. Thanks/*** This is the Original Table that needs to be split into multiple records ***/CREATE TABLE TestTable(SalesOrder VARCHAR(7), TotalMin INT)INSERT INTO dbo.TestTable ( SalesOrder, TotalMin )VALUES ('0164641', 1440 ), ('0191008', 737)/*** This is the what the Final results should look like. ***/CREATE TABLE FinalTable (SalesOrderNo VARCHAR(7),TotalMin INT)INSERT INTO FinalTable ( SalesOrderNo, TotalMin )VALUES ( '0164641', 360 ), ('0164641', 360), ('0164641',360), ('0164641',360), ('0191008', 360), ('0191008', 360), ('0191008',17)

Viewing all articles
Browse latest Browse all 3145

Trending Articles