well, this is strictly not JDBC but a sql question, I have mssql 2005, is there any way in my SELECT query to get the row numbers also? meaning, in addition to the fields theat I SELECT, I want an extra field which just has 1,2,3,...rowcount.
Good question. I don't know of any function that will do that, so I am sort of curious also. I can't find anything in any of my reference materials. Is there some constraint that prevents you from just adding the numbering as you iterate through the resultSet? Or is there an option to create your own function?
Joined: Jun 23, 2004
well, I wish to accomplish this in a single sql select, because this is going to be a part of a bigger complex sql statement, and I want to keep it that way instead of breaking it.
I would think sql should have some sort of a utility function like this.