I think the given problem is different. He needs
to reorder a list of numbers which > is not <
in a correct sequence.
I was wondering how did Patrick finally solve the problem?
John
-----Original Message-----
From: John Obie [mailto:[Email Address Removed]
Sent: Friday, April 25, 2003 2:01 PM
To: LazyDBA.com Discussion
Subject: Re: re-sequence steps
Another approach, which will keep step and sub_step in
order, would be to create a clustered index on the
table. By definition, a clustered index will
maintain the order.
For example:
create table my_test (step int, substep int)
insert into my_test values (1,1)
insert into my_test values (1,2)
insert into my_test values (2,1)
insert into my_test values (2,0)
insert into my_test values (3,1)
insert into my_test values (3,2)
insert into my_test values (3,4)
insert into my_test values (4,1)
insert into my_test values (4,3)
create clustered index foo on my_test(step, substep)
select * from my_test
step substep
----------- -----------
1 1
1 2
2 0
2 1
3 1
3 2
3 4
4 1
4 3
--- "Conahan, Patrick" <Patrick.[Email Address Removed] I have a table that looks like this....there's other
> columns as well. I
> need to re-sequence these step and sub_step
> numbers. How can I use a
> cursor the get the desired affect? Any help would
> be greatly
> appreciated....
>
> what I have now:
> step sub_step
> 1 1
> 1 2
> 3 1
> 3 2
> 3 4
> 4 1
> 4 3
>
> what I need:
> step sub_step
> 1 1
> 1 2
> 2 1
> 2 2
> 2 3
> 3 1
> 3 2
>
> Patrick Conahan
>
>
>
---------------------------------------------------------------------
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT
> JUST REPLY
> To unsubscribe, e-mail:
> mssqldba-[Email Address Removed] For additional commands, e-mail:
> mssqldba-[Email Address Removed]
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page