Sql Server 2005: select row_number() (order by col) as id, * from tablename 非Sql Server 2005: select (select count(*) from tablename b where a.col <= b.col) as ID, a.* from tablename a order by a.col 若表中没有自动增长的列: select IDENTITY(1,1) as ID, * into tb from tableNameselect * from tb