Select in SQL Server with index

1

I would like to know if it is possible to make a select in the Sql Server of a table that does not have an index column, but in this select it presents a sequential index column in ascending order. Ex. Table: Letters

Coluna
D
E
S

And making the select from this table, present to me the result:

Indice Coluna
1        D
2        E
3        S

Is it possible? I need to import data from one bank to another.

    
asked by anonymous 27.08.2014 / 17:08

1 answer

3

I was able to find a solution, I'll post it, maybe it will help someone else.

Select ROW_NUMBER() OVER(ORDER BY GETDATE()) as Indice, Coluna from Letras

In case the row_number () must have an over () that receives a mandatory orderby. As I did not want to sort by any column, but in the order the data was entered in the table, I used the order by GETDATE ().

    
27.08.2014 / 17:18