Click here to Skip to main content
15,879,474 members
Articles / Programming Languages / SQL

Increment the string value letter by letter for every row using SQL server

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
4 Oct 2011CPOL 11.2K  
WITH tempTable(Column1)AS( SELECT 'chaitanya' [Column1] UNION ALL SELEC`T SUBSTRING(Column1,1,LEN(Column1)-1) FROM tempTable WHERE LEN(Column1)>0)SELECT * FROM tempTable ORDER BY LEN(Column1)Result:cchchachaichaitchaitachaitanchaitanychaitanya

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
France France
I am a French programmer.
These days I spend most of my time with the .NET framework, JavaScript and html.

Comments and Discussions