I've got a SQL statement in SQL Server 2005 that looks something like this:
SELECT * INTO #TempTable FROM FirstTable WHERE <complex where clause>
What I would really, really like is to have the resulting temp table have an extra field that is essentially an integer field counting from 1 up in the order the where clause returned the records.
Is this possible?
(Essentially, I want to be able to return a subset of the records returned from the first select statement, along the lines of "lines 45 through 179".)