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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 hai

Author  Topic 

subbu_mareedu
Starting Member

11 Posts

Posted - 2014-04-06 : 05:52:10
hai friends iam new to sql server.i have a table with data as shown below

col1
a
a
a
a
a
a
a
a
But i want my result for same data like

col1
a0
a1
a2
a0
a1
a2
a0
a1
a2

Can u give the solution for this problem friends


subbu

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-04-06 : 06:11:05
[code]
select col1 + convert(char(1), (row_number() over (order by col1) - 1) % 3)
from yourtable
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

subbu_mareedu
Starting Member

11 Posts

Posted - 2014-04-07 : 01:29:12
Thanks khtan


subbu
Go to Top of Page
   

- Advertisement -