sql server - Can select into add a new field to the resulting table? -


I have got SQL Statement in SQL Server 2005, which looks something like this:

 < Select the code> first from where to select in #TempTable & lt; Complex where segment & gt;  

I really would really like that as a result of which there is an additional area in the temporary table, it is essentially the calculation of an integer area in order from where the clause returned the record. / P>

Is this possible?

(Basically, I want to be able to return the subset of the returned record from the first select statement to "Lines 45 to 179" lines.)

Try it:

  - Insert in temporary table SELECT *, ROW_NUMBER () over (Sorted by order sorted) #TempTable in ASCL column beforehand where & lt; Complex where segment & gt; - Check out the result and leave the table SELECT * FROM #TempTable WHERE Clearly you get the  SortColumn 
179 order by column 45 and respectively column drop in the SortColumn < / Code> Whatever makes sense in your case


Edit:

If you are trying to paging, then Examples of this are:


Comments