How to Increment values dynamically in SQL select statement -


i want display values a-z , these values auto increment in select statemnet

my output should this

desk desk b desk c .... .... desk z  

i stuck here

desk no = (select 'desk'+'') 

thanks in advance.

you this, assuming mean tsql and assuming have table you're selecting. if want independently, want make numbers table.

select 'desk ' + char(65 + (((row_number() over(order [somecolumn])) - 1) % 26)) tablename 

of course, becomes million times easier if table has id column has identity set.

select 'desk ' + char(65 + ((id - 1) % 26)) tablename 

on other hand, if have numbers table, that's easier.

select 'desk ' + char(65 + (value % 26)) numbers 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -