Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
srimami
Posting Yak Master
160 Posts |
Posted - 2012-02-08 : 13:59:13
|
| Hi,Can anyone please let me know the solution for my following requirement;My source table is Id Qty Price1 1,1 10.99, 9.992 2,2,2 1.99, 20, 30My target table should be in the following orderId Qty1 Qty2 Qty3 Price1 Price2 Price31 1 1 NULL 10.99 9.99 NULL2 2 2 2 1.99 20 30The datatypes are Int, Varchar(250), Varchar(250) respectively for source table.Can anyone please help me in achieving this using cursors or SP's.Thank you,Sri. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-08 : 14:01:23
|
| are number of Quantity and price values fixed? ie can there be only 3 values max for Quantity and price?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
srimami
Posting Yak Master
160 Posts |
Posted - 2012-02-09 : 16:12:36
|
| The number can go upto 60 for Qty and price |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-09 : 17:48:04
|
| so in those you want all 60 values to come in different columns?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
srimami
Posting Yak Master
160 Posts |
Posted - 2012-02-10 : 14:12:59
|
| Yes |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|