nishav2 (10/1/2014)
Hi ,I am having similar kind of requirement.
I have a table.
create table dbo.test(ID int,Price decimal(18,9), Qty decimal(18,9))
Insert into dbo.test values(1,5000,5000000)
Insert into dbo.test values(2,3000,50000000)
Insert into dbo.test values(3,100,50000)
I need the output in the below format
ID PRICE QTY
1 5000 5000000
2-1 30 5000000
2-2 30 5000000
2-3 30 5000000
2-4 30 5000000
2-5 30 5000000
2-6 30 5000000
2-7 30 5000000
2-8 30 5000000
2-9 30 5000000
2-10 30 5000000
3 100 50000
So the Qty limit is : 5,000000
First record is equal to the limit.So it can appear in the same format as stored in table.
In Second Record -Qty is 10 times greater than our limit.So all the columns are splitted as shown above
Third Row - It is within the limit we have set for Qty.So it can appear in the same format as stored in table.
Any help is appreciated.
Thanks
Nisha V Krishnan
You should start your own threads instead of hijacking a number of other much older threads.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/