Lightwave
Ad astra
- Local time
- Today, 17:46
- Joined
- Sep 27, 2004
- Messages
- 1,521
Dear All
Looking for TSQL appropriate for SQL Azure.
I have a need to create sub records on a table by calculating a split of a volume. I probably haven't explained that very well but if you see the example below it might be clearer. Essentially I have casks and I want to split them into bottles... The below example numbers are a simplified case.
So I would like to generate table 2 below from table 1 - and if I change the split into value it will alter the number of records in table 2.
I would probably create just a query first of all and then I understand how to insert into using select. I'm struggling how to do that split at the moment. I've looked into split with google but so far I keep getting pointed at parsing.
Table 1
pkid Volume Split into
1 100litres 40litres
Table 2
pkid pkidtable1 Volume
1 1 40litres
2 1 40litres
3 1 20litres
I'm thinking I'll have a query just to create a view of table 2 firstly and then I will do an insert query of that query into table 2 (I know how to do that part)
Any guidance much appreciated.
Looking for TSQL appropriate for SQL Azure.
I have a need to create sub records on a table by calculating a split of a volume. I probably haven't explained that very well but if you see the example below it might be clearer. Essentially I have casks and I want to split them into bottles... The below example numbers are a simplified case.
So I would like to generate table 2 below from table 1 - and if I change the split into value it will alter the number of records in table 2.
I would probably create just a query first of all and then I understand how to insert into using select. I'm struggling how to do that split at the moment. I've looked into split with google but so far I keep getting pointed at parsing.
Table 1
pkid Volume Split into
1 100litres 40litres
Table 2
pkid pkidtable1 Volume
1 1 40litres
2 1 40litres
3 1 20litres
I'm thinking I'll have a query just to create a view of table 2 firstly and then I will do an insert query of that query into table 2 (I know how to do that part)
Any guidance much appreciated.
Last edited: