There are many use cases for generating a sequence of values in SQL Server. I'm not talking about a persisted IDENTITY
column (or the new SEQUENCE
in SQL Server 2012), but rather a transient set to be used only for the lifetime of a query. Or even the simplest cases – such as just appending a row number to each row in a resultset – which might involve adding a ROW_NUMBER()
function to the query (or, better yet, in the presentation tier, which has to loop through the results row-by-row anyway).