greetings, wonder if anyone can help with a tricky little problem!
I need to denormalise a table, to get it into a format to load into our telephone system database. I think I can do this once I have achieved this step:
We have an excel sheet containing multiple records per customer, one for each phone number.
it looks something like this:
AccountNumber Phonenumber
000123 01273153456
000123 01273153457
000123 01273153458
000756 01546123456
000756 01546123457
What I need to try and do is add a column to give the instance of each accountnumber ie
LineNumber AccountNumber Phonenumber
1 000123 01273153456
2 000123 01273153457
3 000123 01273153458
1 000756 01546123456
2 000756 01546123457
this gives me a new number for each row, though I dont know how to get it to start new for each accountnumber
declare @linenumber int
set @linenumber = 1
update tbldataload set @linenumber= linenumber = @linenumber + 1
There are a maximum of 6 x account numbers in any one group
hope thats clear and someone may be able to help
all the best
Matt
Matt
Brighton, UK
I need to denormalise a table, to get it into a format to load into our telephone system database. I think I can do this once I have achieved this step:
We have an excel sheet containing multiple records per customer, one for each phone number.
it looks something like this:
AccountNumber Phonenumber
000123 01273153456
000123 01273153457
000123 01273153458
000756 01546123456
000756 01546123457
What I need to try and do is add a column to give the instance of each accountnumber ie
LineNumber AccountNumber Phonenumber
1 000123 01273153456
2 000123 01273153457
3 000123 01273153458
1 000756 01546123456
2 000756 01546123457
this gives me a new number for each row, though I dont know how to get it to start new for each accountnumber
declare @linenumber int
set @linenumber = 1
update tbldataload set @linenumber= linenumber = @linenumber + 1
There are a maximum of 6 x account numbers in any one group
hope thats clear and someone may be able to help
all the best
Matt
Matt
Brighton, UK