You have to use the “ROW_NUMBER() OVER” command to give ids to the records you have in your query.
A full command including “ROW_NUMBER OVER” is as the following:
SELECT ROW_NUMBER() OVER (ORDER BY Column1 ASC) AS RowNo, Column1, Column2, Column3, Column4 FROM Table1
RowNo will be your ID here from 1 to the number of records. The output will be like this:
RowNo Column1 Column3 Column4
1 C1 C2 C3
2 Ca Cb Cc
And so on….
Popularity: 1% [?]
Tags: Microsoft SQL Server, Over, Row_Number