How do I automatically generate a serial number field while retrieving data? Drop Table Temptable Select Identity (Smallint, 1, 1) As SEQNO, YOTABLE. * INTO TEMPTABLE from YourTable Select * from Temptable