Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 reconstract display seq
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

74 Posts

Posted - 07/26/2013 :  07:30:38  Show Profile  Reply with Quote
i have a table with below data:
shop name display_seq
aaa 9
aaa 10
bbb 8
bbb 9

i need to rearrange the display seq from 1. so the table data will be like:
shop name display_seq
aaa 1
aaa 2
bbb 1
bbb 2

Could someone please help me with the query??
Thanks in advance

kalyan Ashis Dey

Flowing Fount of Yak Knowledge

8781 Posts

Posted - 07/26/2013 :  07:44:49  Show Profile  Visit webfred's Homepage  Reply with Quote
update dt
set display_seq = new_seq
(select row_number() over (partition by [shop name] order by display_seq asc) new_seq,* from YourTableName)dt

Too old to Rock'n'Roll too young to die.
Go to Top of Page

Yak Posting Veteran

74 Posts

Posted - 07/26/2013 :  08:51:05  Show Profile  Reply with Quote
Thanks a works..:)

kalyan Ashis Dey
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000