June 21, 2006 at 2:18 pm
Hi, I have the following table:
nr pos article count
1 1001 2
1 1005 4
1 1000 1
2 1005 1
2 1004 3
Now I need a script which I can use in a DTS package which set me the pos number like this:
nr pos article count
1 1 1001 2
1 2 1005 4
1 3 1000 1
2 1 1005 1
...
Thanks in advance !
Regards, Markus
June 21, 2006 at 2:38 pm
I can't see what ordering algorithm you want to use. Position in what sequence?
Tim Wilkinson
"If it doesn't work in practice, you're using the wrong theory"
- Immanuel Kant
June 21, 2006 at 3:36 pm
oh, sorry. every articel have a date !
have you a idea ?
June 21, 2006 at 4:16 pm
I'm not sure whether a stored proc would be approriate for your situation, but if so:
@ord int, @emp int, @lastemp int
#ohnonotanothertemptable(EmployeeID, RateChangeDate, rate)
e.EmployeeID, e.RateChangeDate, e.rate
HumanResources.EmployeePayHistory e
by e.EmployeeID, e.RateChangeDate
#ohnonotanothertemptable
@emp = EmployeeID
@ord = case @emp when @lastemp then @ord + 1 else 1 end
@lastemp = @emp
ord = @ord
EmployeeID, RateChangeDate, ord, rate
#ohnonotanothertemptable
table #ohnonotanothertemptable
Tim Wilkinson
"If it doesn't work in practice, you're using the wrong theory"
- Immanuel Kant
June 22, 2006 at 1:30 am
Thanks in advance. Now My table name is
Article. Can you help me to adapt the code for me (table,columns) ? I can't it. sorry.
Regards,
Markus
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply