SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 hai
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

subbu_mareedu
Starting Member

India
9 Posts

Posted - 04/06/2014 :  05:52:10  Show Profile  Reply with Quote
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)

Singapore
17608 Posts

Posted - 04/06/2014 :  06:11:05  Show Profile  Reply with Quote

select	col1 + convert(char(1), (row_number() over (order by col1) - 1) % 3)
from	yourtable



KH
Time is always against us

Go to Top of Page

subbu_mareedu
Starting Member

India
9 Posts

Posted - 04/07/2014 :  01:29:12  Show Profile  Reply with Quote
Thanks khtan


subbu
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.05 seconds. Powered By: Snitz Forums 2000